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

📄 answeraction.java

📁 openblog是一个博客管理系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package org.openblog.struts.comment.action;

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.openblog.hibernate.Comment;
import org.openblog.hibernate.CommentDAO;
import org.openblog.struts.comment.form.CommentForm;
import java.util.Date;
import java.text.SimpleDateFormat;

/** 
 * MyEclipse Struts
 * Creation date: 12-18-2008
 * 
 * XDoclet definition:
 * @struts.action input="/answercomment.jsp" validate="true"
 * @struts.action-forward name="goto" path="Answer.do"
 */
public class AnswerAction 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) {
		// TODO Auto-generated method stub
		Date date = new Date();
		String format = "yyyy年MM月dd日 HH:mm";
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		String nowDate = sdf.format(date);
		CommentForm commentform =(CommentForm)form;
		String Content="";
		Comment comment = new Comment();
		CommentDAO commentdao =new CommentDAO();
		Comment find = commentdao.findById(Integer.valueOf(request.getParameter("commentid")));
		Content= "回复"+Content+find.getCommentName()+":";
		comment.setCommentContent(Content+commentform.getCommentcontent());
		comment.setCommentName("主人回复");
		comment.setCommentQq("5947313");
		comment.setCommentEmail("reyoung729@gmail.com");
		comment.setCommentUrl("http://www.reyoung729.cn");
		comment.setCommentStatus(Integer.valueOf(request.getParameter("commentid")));
		comment.setArticle(commentdao.findById(Integer.valueOf(request.getParameter("commentid"))).getArticle());
		comment.setCommentDate(nowDate);
		commentdao.save(comment);
		find.setCommentStatus(Integer.valueOf(request.getParameter("commentid")));
		commentdao.modify(find);
		return mapping.findForward("goto");
	}
}

⌨️ 快捷键说明

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