📄 topicservlet.java
字号:
/*
* Created on 2007-3-17
* Last modified on 2007-9-16
* Powered by YeQiangWei.com
*/
package com.yeqiangwei.club.controller.servlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeqiangwei.club.controller.action.ReplyAction;
import com.yeqiangwei.club.controller.action.TopicAction;
import com.yeqiangwei.club.util.MessageUtils;
import com.yeqiangwei.club.view.util.UrlUtils;
import com.yeqiangwei.club.view.util.UserSetUtils;
import com.yeqiangwei.util.HttpServletUtils;
import com.yeqiangwei.util.ParamUtils;
import com.yeqiangwei.util.Validator;
public class TopicServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
private TopicAction topicAction;
private ReplyAction replyAction;
public void doGet(HttpServletRequest request,HttpServletResponse response)
{
String act = ParamUtils.getStringParameter(request,"act");
if(act.equals("style")){
String style = UserSetUtils.find(request,UserSetUtils.THREAD_STYLE);
if(style.equals("1")){
UserSetUtils.update(request,response,UserSetUtils.THREAD_STYLE,"0");
}else{
UserSetUtils.update(request,response,UserSetUtils.THREAD_STYLE,"1");
}
//int topicId = ParamUtils.getIntParameter(request,"topicId");
//int forumId = ParamUtils.getIntParameter(request,"forumId");
//HttpServletUtils.redirect(response,UrlUtils.getUrl(UrlUtils.TOPIC,topicId,forumId,request));
HttpServletUtils.redirect(response,UrlUtils.getTopicUrl(request));
}
else if(act.equalsIgnoreCase("findNextOrPrevious")){
this.getTopicAction().findNextOrPrevious(request,response);
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
{
response.setContentType("text/HTML;charset=UTF-8");
String act = ParamUtils.getStringParameter(request,"act","addtopic");
if(act.equals("addtopic")||act.equals("edittopic")){
this.getTopicAction().createOrUpdate(request,response);
}
else if(act.equals("addreply")||act.equals("editreply")){
this.getReplyAction().createOrUpdate(request,response,act);
}
else if(act.equals("movetopic")){
this.getTopicAction().move(request,response);
}
else if(act.equals("better")){
this.getTopicAction().better(request,response);
}
else if(act.equals("trashtopic")){
this.getTopicAction().trash(request,response);
}
else if(act.equals("trashreply")){
this.getReplyAction().trash(request,response);
}
else{
request.setAttribute("message",MessageUtils.getMessage("error_notfind"));
HttpServletUtils.forward(request,response,"/club/msg.jsp");
return;
}
}
public TopicAction getTopicAction() {
if(Validator.isEmpty(topicAction)){
topicAction = new TopicAction();
}
return topicAction;
}
public ReplyAction getReplyAction() {
if(Validator.isEmpty(replyAction)){
replyAction = new ReplyAction();
}
return replyAction;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -