📄 postaction.java
字号:
/*******************************************************************\* ** LightningBoard ** ** http://sourceforge.net/projects/lightningboard/ ** ** Copyright (c) 2002 Xiaobo Liu ** *********************************************************************** LICENSE INFORMATION ** ** LightningBoard is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as ** published by the Free Software Foundation; either version 2 of ** the License, or any later version. ** ** We don't charge anything for the use of LightningBoard, we only ** require you to keep the copyright present on your site and in ** the source files. ** ** LightningBoard is distributed in the hope that it will be useful,** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. See the GNU ** General Public License for more details. ** *\*******************************************************************/package liuxiaobo.lb.action;import java.io.*;import javax.servlet.*;import javax.servlet.http.*;import liuxiaobo.util.*;import liuxiaobo.lb.*;import liuxiaobo.lb.dao.*;import liuxiaobo.lb.bean.*;public class PostAction { public String excute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException ,ActionException{ HttpSession sess = request.getSession(false); LoginBean loginBean=(LoginBean)sess.getAttribute("loginBean"); int u_id=StringUtil.parseInt(loginBean.getU_id()); int f_id =StringUtil.parseInt(request.getParameter("f_id")); int t_id =StringUtil.parseInt(request.getParameter("t_id")); String subject=request.getParameter("subject"); subject=StringUtil.escapeSQLTags(subject); subject=StringUtil.escapeHTMLTags(subject); String content=request.getParameter("content"); content=StringUtil.escapeSQLTags(content); content=StringUtil.escapeHTMLTags(content); content=StringUtil.encodeCR(content); String u_lastip=request.getRemoteAddr(); boolean postFlag=true; if (t_id!=0) postFlag=false; if (StringUtil.nullOrBlank(content)||(postFlag&&StringUtil.nullOrBlank(subject))){ request.setAttribute("actionMessage",new ActionMessage("blank_error")); return "/actionMessage.jsp"; } PostDAO postDAO=new PostDAO(); String urlString="topic.do?t_id="; if (postFlag){ urlString=urlString+postDAO.post(f_id,u_id,subject,content,u_lastip); }else{ urlString=urlString+t_id; postDAO.reply(t_id,u_id,content,u_lastip); } response.sendRedirect(urlString); return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -