⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forumservlet.java

📁 野蔷薇论坛源码 java 自己看看吧。 学习用
💻 JAVA
字号:
/* 
 * Created on 2007-2-17
 * Last modified on 2007-7-27
 * 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.ForumAction;
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.Validator;

//import com.yeqiangwei.club.controller.action.ForumAction;
import com.yeqiangwei.util.ParamUtils;

public class ForumServlet extends HttpServlet {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private ForumAction forumAction;

	public void doGet(HttpServletRequest request, HttpServletResponse response){
		String act = ParamUtils.getStringParameter(request,"act");
		if(act.equals("style")){
			String style = UserSetUtils.find(request,UserSetUtils.FORUM_STYLE);
			request.setAttribute("forumId",ParamUtils.getStringParameter(request,"forumId"));
			if(style==null||style.equals("0")){
				UserSetUtils.update(request,response,UserSetUtils.FORUM_STYLE,"1");
			}else{
				UserSetUtils.update(request,response,UserSetUtils.FORUM_STYLE,"0");
			}
			HttpServletUtils.redirect(response
					,UrlUtils.getUrl(UrlUtils.FORUM
							,ParamUtils.getIntParameter(request,"forumId"),0,request));
		}
		else if(act.equals("doFavorite")){
			this.getForumAction().doFavorite(request,response);
		}
		else if(act.equals("delFavorite")){
			this.getForumAction().delFavorite(request,response);
		}
	}
	
	public void doPost(HttpServletRequest request
			,HttpServletResponse response) {
		response.setContentType("text/HTML;charset=UTF-8"); 
		String act = ParamUtils.getStringParameter(request,"act");
		if(act.equals("addLabel")){
			this.getForumAction().createLabel();
		}
		request.setAttribute("message",MessageUtils.getMessage("error_notfind"));
		HttpServletUtils.forward(request,response,"/club/msg.jsp");
		return;
	}

	public ForumAction getForumAction() {
		if(Validator.isEmpty(forumAction)){
			forumAction = new ForumAction();
		}
		return forumAction;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -