⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commentaddaction.java

📁 在线信息发布系统。在Eclipse下进行开发结合了struts等主流技术
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package action;

import java.util.Date;

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 po.comment.*;
import service.*;
import form.CommentAddForm;


/** 
 * MyEclipse Struts
 * Creation date: 03-19-2007
 * 
 * XDoclet definition:
 * @struts.action path="/commentAdd" name="commentAddForm" input="/CommentAdd.jsp" scope="request" validate="true"
 * @struts.action-forward name="success" path="/NewsContent.jsp"
 */
public class CommentAddAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CommentAddForm commentAddForm = (CommentAddForm) form;

		Commentt comment=new Commentt();
		
		comment.setNewsId(Integer.valueOf(commentAddForm.getNewsId()));
		comment.setCommentId(new Integer(0));	//自增量只需设为0即可
		comment.setContent(commentAddForm.getContent());
		comment.setAuthor(commentAddForm.getAuthor());
		comment.setTime(new Date());
		
		CommentService.addComment(comment);
		
		return new ActionForward("/newsContent.do?newstId="+commentAddForm.getNewsId());
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -