📄 editthreadlinkaction.java
字号:
/* * XP Forum * * Copyright (c) 2002-2003 RedSoft Group. All rights reserved. * */package org.redsoft.forum.web;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.redsoft.forum.ForumConstants;import org.redsoft.forum.dao.DAOFactory;import org.redsoft.forum.dao.PersistentThread;import org.redsoft.forum.dao.ThreadDAO;import org.redsoft.forum.exception.DAOException;import org.redsoft.forum.exception.ThreadNotFoundException;import org.redsoft.forum.dao.Thread;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/** * an action that wraps the link to editThread.jsp * * @@author <a href="mailto:chjxm@msn.com">cinc</a> * * @@version $Id: EditThreadLinkAction.java,v 1.3 2004/02/26 03:05:37 mustang Exp $ * */public class EditThreadLinkAction extends Action { /** * * @param mapping * @param form * @param request * @param response * @return * @throws ThreadNotFoundException if a thread is not found, * handle this exception in strust-config.xml * @throws DAOException if error accessing database * handle this exception in strust-config.xml */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ThreadNotFoundException, DAOException { final String threadID = request.getParameter(ForumConstants.THREAD_ID_PARAM); if ((threadID == null) || (threadID.equals(""))) { throw new ThreadNotFoundException( "with null id" ); } else { final ThreadDAO dao = DAOFactory.getInstance().getThreadDAO(); final PersistentThread thread = dao.findByUID( Long.parseLong( threadID ) ); // Return a immutable thread object back to jsp instead of a mutable PersistentThread object request.setAttribute( ForumConstants.MY_THREAD_PARAM, new Thread( thread.getTitle(), thread.getContent(), thread.isNotify() )); } // Forward control to the specified success URI return (mapping.findForward("success")); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -