I want to use default exception handler and don't want to customize it.
In my struts-config.xml file have defined global exception as follows.
<global-exceptions>
<exception bundle="ApplicationResources"
key="error.db.sql"
type="java.sql.DbException"
path="/WEB-INF/jsp/errorpg.jsp" >
</exception>
<exception bundle="ApplicationResources"
key="error.db.noconnection"
type="com.NoDbConnection"
path="/WEB-INF/jsp/errorpg.jsp" >
</exception>
</global-exceptions>
In errorpg.jsp, I am trying to display the key passed to errorpg.jsp as follows( Note: First two lines are entered for debugging) -
${Globals.EXCEPTION_KEY}
<%= request.getAttribute("Globals.EXCEPTION_KEY") %><fmt:message key="errorpg.msg.sorryerror">
<fmt
aram value='${Globals.EXCEPTION_KEY}'/>
</fmt:message>
In ApplicationResources file "errorpg.msg.sorryerror" is defined as
"Sorry, for following reason we cant continue. Reason- {1} "
When exception is generated, errorpg.jsp is displayed as expected but the message I get is-
null Sorry, for following reason we cant continue. Reason- {1}
So for some reason Globals.EXCEPTION_KEY does not contain anything. Can you tell me what am I doing wrong? Is there something I need to set which will populate Globals.EXCEPTION_KEY?