I ripped the guts of the error tag to get at the final errors messages.
This will allow me now to write customised error messages in my JSP
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="org.apache.struts.action.*" %>
...
ActionErrors errors = (ActionErrors)pageContext.findAttribute(
Action.ERROR_KEY );
if ( errors != null && !errors.empty() ) {
List errorCollection = new ArrayList();
Iterator reports = errors.get();
while ( reports.hasNext() ) {
ActionError report = (ActionError) reports.next();
String message = RequestUtils.message(
pageContext, Action.MESSAGES_KEY, Action.LOCALE_KEY,
report.getKey(), report.getValues());
errorCollection.add( message );
}
request.setAttribute("errorCollection", errorCollection );
%>
<ul>
<logic:iterate id="oneError" name="errorCollection"
indexId="counter" type="java.lang.String" >
<bean:write name="oneError" filter="false" />
</logic:iterate>
</ul>
There is a lot of Scriptlet code here. Looks like it will be a tiny custom tag action
project somebody.
<pp:errorCollection id="oneError" indexId="counter" >
<bean:write name="oneError" filter="false" />
<pp:errorCollection/>
Let me know how you get on!
--
Peter Pilgrim ++44 (0)207-545-9923
//_\\
"Mathematics is essentially the study of islands of =======
disparate subjects in a sea of ignorance." || ! ||
Andrew Wiles _____________
---------------------------------------- Message History
----------------------------------------
From: Peter Pilgrim/DMGIT/DMG UK/DeuBa@DMG UK on 03/01/2002 12:15
Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: Where can I find <html:messages> ?
I want to customise the errors messages for invalid data entry.
Where can I get my hands on the <html:messages> tag?
This tag does not exists Struts 1.0 ?
Or how can use the present tags to iterate through the
error messages?
--
Peter Pilgrim ++44 (0)207-545-9923
//_\\
"Mathematics is essentially the study of islands of =======
disparate subjects in a sea of ignorance." || ! ||
Andrew Wiles __________________________/\________/\__||_!_||__
--
This e-mail may contain confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please notify the sender
immediately and destroy this e-mail. Any unauthorized copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
This e-mail may contain confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please notify the sender
immediately and destroy this e-mail. Any unauthorized copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>