package com.sanqing.action; import java.util.Date; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.sanqing.po.Article; import com.sanqing.service.ArticleService; 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; } }

huhansan LV10
2023年11月5日
陆程江 LV2
2023年5月23日
Violetya LV1
2023年5月19日
123123asdsada LV1
2022年5月25日
wanglinddad LV55
2022年4月13日
and123456 LV11
2022年2月7日
2136237322 LV1
2021年12月15日
cloisonne LV2
2021年12月11日
1287704475 LV2
2021年12月8日
李晓珂 LV2
2021年12月4日