package com.ibeifeng.action; import java.util.Date; import java.util.Map; import com.ibeifeng.po.Article; import com.ibeifeng.service.ArticleService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class AddArticle extends ActionSupport { private String title; private String content; private ArticleService articleService; public ArticleService getArticleService() { return articleService; } public void setArticleService(ArticleService articleService) { this.articleService = articleService; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String execute() throws Exception { Map session = ActionContext.getContext().getSession(); String username = (String) session.get("username"); //封装一个PO类的对象 Article article = new Article(); article.setTitle(title); article.setContent(content); article.setUsername(username); article.setDate(new Date()); article.setHasread(0); articleService.addArticle(article); return this.SUCCESS; } }

aaaaaaa3333 LV1
2022年5月18日
SOLEIL. LV3
2021年6月19日
yyyyyyuuuuuu LV1
2021年2月14日
无情先生3333 LV2
2020年12月29日
skook7 LV2
2020年7月26日
lwp011 LV27
2020年7月7日
1515355665 LV7
2020年7月2日
王步庆 LV9
2020年5月14日
小陆啊 LV2
2020年3月8日
12432423 LV2
2019年12月18日