📄 afficheaction.java
字号:
package com.ntsky.bbs.action;import org.apache.struts.action.*;import javax.servlet.http.*;import org.apache.log4j.Logger ;import com.ntsky.xml.bbs.XMLCreator;import com.ntsky.bbs.action.Constant;import com.ntsky.bbs.form.AfficheActionForm;import com.ntsky.xml.bbs.dto.AfficheDTO;/** * <p>Title: Ntsky OpenSource BBS</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: WWW.FM880.COM</p> * @author 姚君林 * @version 1.0 */public class AfficheAction extends Action { private final static Logger logger = Logger.getLogger(AfficheAction.class); public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception{ /**@todo: complete the business logic here, this is just a skeleton.*/ AfficheActionForm afficheActionForm = (AfficheActionForm)actionForm; AfficheDTO afficheDTO = XMLCreator.getInstance().getAfficheXML().getAffiche(); /** * 设置初始显示值 */ String position = httpServletRequest.getParameter("position"); logger.info("position = " + position); if((Constant.POSITION).equals(position)){ afficheActionForm.setTitle(afficheDTO.getTitle()); afficheActionForm.setTime(afficheDTO.getTime()); logger.info("成功跳转到公告页面..."); return actionMapping.findForward("page"); } if("all".equals(position)){ /** * 显示全部信息 */ //afficheActionForm.setTitle(afficheDTO.getTitle()); httpServletRequest.setAttribute("afficheTitle",afficheDTO.getTitle()); //afficheActionForm.setContent(afficheDTO.getContent()); httpServletRequest.setAttribute("afficheContent",afficheDTO.getContent()); afficheActionForm.setName(afficheDTO.getName()); afficheActionForm.setTime(afficheDTO.getTime()); logger.info("成功跳转到公告弹出页面..."); return actionMapping.findForward("all"); } /** * 用户权限判断 */ HttpSession session = httpServletRequest.getSession(); String admin = (String)session.getAttribute(Constant.ADMIN_KEY); if(admin == null){ return actionMapping.findForward("admin_logon"); } afficheActionForm.setTitle(afficheDTO.getTitle()); afficheActionForm.setContent(afficheDTO.getContent()); afficheActionForm.setName(afficheDTO.getName()); afficheActionForm.setTime(afficheDTO.getTime()); return actionMapping.findForward("success"); //throw new java.lang.UnsupportedOperationException("Method perform() not yet implemented."); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -