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

📄 articleaddaction.java

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

import java.text.SimpleDateFormat;
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 org.openblog.hibernate.Article;
import org.openblog.hibernate.ArticleDAO;
import org.openblog.hibernate.SortDAO;
import org.openblog.struts.article.form.ArticleForm;


/** 
 * MyEclipse Struts
 * Creation date: 12-18-2008
 * 
 * XDoclet definition:
 * @struts.action input="/article_add.jsp" validate="true"
 * @struts.action-forward name="goto" path="/showArticleList.do"
 */
public class ArticleAddAction 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
		ArticleForm articleform = (ArticleForm)form;
		Date date = new Date();
		String format = "yyyy-MM-dd HH:mm";
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		String nowDate = sdf.format(date);
		
		Article article = new Article();
		
		ArticleDAO articleDAO=new ArticleDAO();
		
		article.setSort(new SortDAO().findById(Integer.valueOf(articleform.getArticleSortId())));
		
		article.setArticleTitle(articleform.getArticleTitle());
		
		article.setArticleContent(articleform.getArticleContext());
		
		article.setArticleDate(nowDate);
		
		article.setArticleCount(new Integer(0));

		//System.out.println("articleAddForm.getArticleUser()"+articleAddForm.getArticleUser());
		articleDAO.save(article);

		return mapping.findForward("goto");
	}
}

⌨️ 快捷键说明

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