📄 handleexceptionaction.java
字号:
/* @LICENSE_COPYRIGHT@ */
package net.sf.irunninglog.servlet.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import net.sf.irunninglog.servlet.RequestProcessor;
import net.sf.irunninglog.servlet.UserContainer;
import net.sf.irunninglog.servlet.formbean.ExceptionContainerFormBean;
/**
* Action used to handle exceptions. This action class will retrieve the
* exception to be handled from the request and populate the <code>
* ExceptionContainerFormBean</code> that will be used to display the exception
* in the view tier.
*
* @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a>
* @version $Revision: 1.1 $ $Date: 2005/06/30 02:01:05 $
* @since iRunningLog 1.0
*/
public final class HandleExceptionAction extends BaseAction {
/**
* Handle an exception by getting the exception out of the request and
* populate the form bean.
*
* @param mapping The <code>ActionMapping</code> used to select this
* instance. The parameter must contain the action to be
* performed
* @param form The optional <code>ActionForm</code> bean for this request
* @param request The HTTP request being processed
* @param response The HTTP response being processed
* @param container The <code>UserContainer</code> object for the current
* user
* @return The forward describing where/how to forward control
* @exception Exception if the application business logic throws
* an exception
*/
public ActionForward executeAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
UserContainer container)
throws Exception {
ExceptionContainerFormBean con = (ExceptionContainerFormBean) form;
String paramKey = RequestProcessor.REQUEST_ATTR_EXCEPTION;
Exception ex = (Exception) request.getAttribute(paramKey);
con.setException(ex);
return mapping.findForward(RequestProcessor.FORWARD_SUCCESS);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -