📄 globalexceptionhandler.java
字号:
/*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -