Struts error handling

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top