struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Reumann" <>
Subject [LAZY] I could research this, but crunched for time... using different messages?
Date Fri, 15 Feb 2008 15:49:08 GMT
Struts 1.1..

How would I display validation messages different than other standard
messages that I want to display? I'm using a common messages header,
but I'd like to modify it so that I could display errors differently.
It probably has to do with how I'm saving messages...

For example for Validation errors:

errors.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("errors.req", "Something"));
saveErrors(request, errors);

//display a success message
messages.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("message.update.success", person.getName()));
saveMessages(request, messages);

The problem is I'm doing the same thing for other types of errors as well:

//display and error message of update of person failed
errors.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("errors.update.failed", person.getName()));
saveErrors(request, errors);

Everything is fine between success messages, but I'd like to be able
to display my validation errors differenty.. for example below I'm
using a <li> but maybe for regular error messages I don't want to use
a list. What's the best way to save different type of messages .. I'll
only have three.. validationErrors, regularErrors, and

Here is my common page header for the display...

<div id="messageSection">
	<c:if test='${ !empty
requestScope["org.apache.struts.action.ACTION_MESSAGE"] }'>
	    <html:messages id="msg" message="true">
	        <span class="message"><c:out value="${msg}"
	<c:if test='${ !empty requestScope["org.apache.struts.action.ERROR"] }'>
	    <ul class="listError">
	    <html:messages id="error" message="false">
	        <li><c:out value="${error}" escapeXml="true"/></li>


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message