T
Tim Slattery
I'm trying to convert a Struts app from version 1.1 to the latest
production version, 1.2.8. The sticking point is reporting errors.
ActionErrors is now deprecated, soon to disappear, so I've converted
instances of ActionErrors to ActionMessages. The exception handling
code looks like this (ex is the exception, request is the
HttpServletRequest object):
ActionMessages errors = new ActionMessages();
String msg = ex.getMessage();
ActionMessage newError = new
ActionMessage("error.generic.placeholder",
ex.getMessage());
errors.add( ActionMessages.GLOBAL_MESSAGE, newError );
saveErrors( request, errors );
return mapping.findForward("SystemFailure");
"SystemFailure" is a page with an "<html-el:errors/> tag in it.
My web.xml includes a <servlet> tag defining the Struts ActionServlet
and having this <init-param> tag:
<init-param>
<param-name>application</param-name>
<param-value>freqs</param-value>
</init-param>
In the WEB-INF/classes is a file named freqs.properties. Its contents
are:
errors.header=<BR><STRONG class="error">
errors.footer=</STRONG>
error.generic.placeholder={0}
When I run this, I get this error:
javax.servlet.jsp.JspException: Cannot find message resources under
key org.apache.struts.action.MESSAGE
It happens during processing of the <html-el:errors/> tag. What did I
do wrong?
production version, 1.2.8. The sticking point is reporting errors.
ActionErrors is now deprecated, soon to disappear, so I've converted
instances of ActionErrors to ActionMessages. The exception handling
code looks like this (ex is the exception, request is the
HttpServletRequest object):
ActionMessages errors = new ActionMessages();
String msg = ex.getMessage();
ActionMessage newError = new
ActionMessage("error.generic.placeholder",
ex.getMessage());
errors.add( ActionMessages.GLOBAL_MESSAGE, newError );
saveErrors( request, errors );
return mapping.findForward("SystemFailure");
"SystemFailure" is a page with an "<html-el:errors/> tag in it.
My web.xml includes a <servlet> tag defining the Struts ActionServlet
and having this <init-param> tag:
<init-param>
<param-name>application</param-name>
<param-value>freqs</param-value>
</init-param>
In the WEB-INF/classes is a file named freqs.properties. Its contents
are:
errors.header=<BR><STRONG class="error">
errors.footer=</STRONG>
error.generic.placeholder={0}
When I run this, I get this error:
javax.servlet.jsp.JspException: Cannot find message resources under
key org.apache.struts.action.MESSAGE
It happens during processing of the <html-el:errors/> tag. What did I
do wrong?