package com.oa.action;
import java.util.Date;
import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.oa.base.BaseAction;
import com.oa.domain.Reply;
import com.oa.domain.Topic;
import com.opensymphony.xwork2.ActionContext;
@Controller
@Scope("prototype")
public class ReplyAction extends BaseAction<Reply> {
/**
*
*/
private static final long serialVersionUID = 1L;
private Long topicId;
/**
* 发表回帖页面
* @return
* @throws Exception
*/
public String addUI() throws Exception {
//准备数据
Topic topic = topicService.findById(topicId);
ActionContext.getContext().put("topic", topic);
return "addUI";
}
/**
* 发表回帖
* @return
* @throws Exception
*/
public String add() throws Exception {
//封装
// >>> 表单字段 已经封装了 title content
model.setTopic(topicService.findById(topicId));
// >>> 当前信息
model.setAuthor(getCurrentUser());//当前用户
model.setIpAddr(ServletActionContext.getRequest().getRemoteAddr());
model.setPostTime(new Date());//当前时间
//保存
replyService.save(model);
return "toTopicShow";//转到新回复所在主题的显示页面
}
// ===================================================
public Long getTopicId() {
return topicId;
}
public void setTopicId(Long topicId) {
this.topicId = topicId;
}
}
最近下载更多
xiaohuaidan455 LV2
2月21日
朱俪的邮件及存储 LV8
2023年4月28日
泓鼎168 LV20
2023年3月30日
wanglinddad LV55
2022年5月26日
529948627 LV6
2022年3月14日
蛇蛇皮怪 LV14
2022年3月8日
微信网友_5845420553359360 LV4
2022年2月25日
juanito8396 LV6
2021年12月20日
and123456 LV11
2021年5月11日
shiyujir LV7
2021年4月8日

最近浏览