📄 addcommentaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.eatery.comment.action;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.context.ApplicationContext;
import com.xaccp.vo.CommentVO;
/**
* MyEclipse Struts
* Creation date: 06-08-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class AddCommentAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String foodName=request.getParameter("foodName");
String userName=request.getParameter("userName");
String comment=request.getParameter("comment");
CommentVO commentVO=new CommentVO();
commentVO.setFoodName(foodName);
commentVO.setUserName(userName);
commentVO.setComment(comment);
SimpleDateFormat date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("toime1="+date.format(new Date()).toString());
commentVO.setDateTime(date.format(new Date()).toString());
System.out.println("time="+commentVO.getDateTime());
List list=(List) servlet.getServletContext().getAttribute("FoodCommentList");
list.add(commentVO);
servlet.getServletContext().setAttribute("FoodCommentList", list);
return mapping.findForward("findAllComment");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -