globalexceptionhandler.java
来自「java的异常api,说明了里边的所有异常」· Java 代码 · 共 46 行
JAVA
46 行
/*
* Created on Aug 9, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.nscorp.struts_class.handler;
import org.apache.struts.action.ExceptionHandler;
import org.apache.struts.action.*;
import org.apache.struts.config.*;
import javax.servlet.http.*;
import javax.servlet.*;
import com.nscorp.struts_class.form.*;
import org.apache.struts.*;
/**
* @author pk47r
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class GlobalExceptionHandler extends ExceptionHandler {
public ActionForward execute(java.lang.Exception ex,
ExceptionConfig ae,
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
ErrorFormBean efB = new ErrorFormBean();
efB.setMessage(ex.toString());
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("REALLY.BIG.BOO.BOO"));
// saveErrors(request,errors);
HttpSession sC = request.getSession();
request.setAttribute(Globals.ERROR_KEY, errors);
sC.setAttribute("errorBean", efB);
return (mapping.findForward("Error"));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?