You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Prakash Inuganti -X (pinugant - Digital-X, Inc. at Cisco)" <pi...@cisco.com> on 2006/12/18 01:15:55 UTC

Global Exception not working for me

Hi,

The issue I have might be due to something very basic I am missing but
for me I can't make this work. I am trying to capture any errors that
happen in my application and show them in an error page.

In my LookupDispatchAction class I have

public ActionForward save(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse
response)
			throws Exception {
		try{
			// Code
		}catch(Exception e){
			e.printStackTrace();
			logger.error(e.getMessage());
			throw e;
		}
		return (mapping.findForward("success"));
}

In my struts-config I have a global Exception and key below defined in
Resources.properties file.

 <global-exceptions>
   <exception key="my.exception" type="java.lang.Exception"
path="/pages/Error.jsp"></exception>
  </global-exceptions>

I tried forcing errors but my error page never gets displayed. My
application just ignores the errors and goes to success page. I can see
stack trace in my console.

What am I doing wrong? Any help is appreciated.

Thanks in Advance
Prakash