Hi All,

When ever there is an error I need to handle the exceptions gracefully.
Since I'm using struts frame work I'm using global-exceptions declarative.

Here is the struts-config.xml where I have included <global-exceptions>
<global-exceptions>
<exception handler="com.hp.chrs.action.ActionExceptionHandler"
type="java.lang.Exception"
key="global.error.message"
path="/jsp/chrs_error.jsp" />
</global-exceptions>

I have written ActionExceptionHandler.java class which is the subclass of
ExceptionHandler. In execute function of this I'm logging the error then
forwarding it to chrs_error.jsp.
public ActionForward execute(Exception ex, ExceptionConfig ae,
ActionMapping mapping,
ActionForm formInstance,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException {
System.out.println("Inside execute of ActionExceptionHandler");
logError(ex);
//forward to the jsp
ActionForward forward =
super.execute(ex, ae, mapping, formInstance, request, response);
}
When ever an error occurs chrs_error.jsp is displayed. But it is not going
to ActionExceptionHandler.java class.

What my unerstanding is whenever error occurs it should go to
ActionExceptionHandler and then display chrs_error.jsp.

Any inputs are welcome

Thanks in Advance

Reply via email to