首页>代码>java SSH框架开发毕业设计-湖南科技大学资源分享系统,数据库mysql5.5,DIV+CSS布局>/Research/src/com/hnust/research/action/CommentAction.java
package com.hnust.research.action; import java.net.URLDecoder; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.hnust.research.base.BaseAction; import com.hnust.research.domain.Comment; import com.hnust.research.domain.User; import com.hnust.research.util.QueryHelper; import com.opensymphony.xwork2.ActionContext; @Controller @Scope("prototype") public class CommentAction extends BaseAction<Comment>{ private String result; public String comment() throws Exception{ User user=(User) ActionContext.getContext().getSession().get("user"); if(user!=null){ model.setDatetime(new Date()); model.setUser(user); //为了解决ajax传值乱码 model.setComment(URLDecoder.decode(model.getComment(),"UTF-8")); commentService.save(model); SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); result="{'result':'yes','comment':'"+model.getComment()+"','img':'"+user.getImgpath()+"','time':'"+simpleDateFormat.format(model.getDatetime())+"','username':'"+user.getUsername()+"'}"; }else{ result="{'result':'no'}"; } return "comment"; } public String list() throws Exception{ QueryHelper queryHelper=new QueryHelper(Comment.class, "comment"); queryHelper.preparePageBean(commentService, pageNum, pageSize); return "list"; } public String delete() throws Exception{ commentService.delete(model.getId()); return "toList"; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } }
最近下载更多
ziv5466123 LV7
2023年12月15日
xuweiwowzy LV5
2023年7月30日
wanglei92 LV2
2023年6月26日
hosinvm LV7
2022年11月18日
123456781 LV4
2022年7月13日
二十一画 LV10
2022年6月25日
微信网友_5963854197018624 LV7
2022年5月21日
buchifanqie LV2
2022年3月22日
八云橙 LV1
2022年3月8日
行家文化 LV1
2022年2月8日
最近浏览更多
12345644
昨天
暂无贡献等级
zolscy LV12
昨天
15103432984 LV2
3月17日
1203093322
2023年12月31日
暂无贡献等级
ziv5466123 LV7
2023年12月15日
2010160433 LV3
2023年11月30日
空中飞尘 LV13
2023年11月25日
1waxzsq212345 LV2
2023年11月22日
Henew168 LV2
2023年11月19日
去码头整点薯条 LV3
2023年11月15日