Ha, ha - you have to stand firm mate ;-) - having said that if my wife says
"down tools" I do too - PDQ!
The ActionMessages class and <html:messages> tag are new versions which it
seems are there to replace ActionErrors and <html:errors> so I guess they
are the future. So far I haven't got round to moving over to them yet but
yes, essentially it does the same thing but in a slightly different way.
>From what I understand the <html:messages> tag differs in the following
ways:
* You specify an "id" attribute in <html:messages> which specifies a page
scope bean in which the tag will store the current message for each
iteration - I believe you then have to use something to write out the
message - like <bean:write>
* Using the message="true" will display messages stored under the
Globals.MESSAGE_KEY constant (rather than the default Globals.ERROR_KEY ) -
means you can use it for other messages as well as errors.
* <html:errors> uses the "errors.footer" and "errors.header" keys to get the
header/footer from the application resources - <html:messages> you can
specify these keys using "header" and "footer" attributes on the tag - means
you can have different header/footer for different pages.
So to do you're example I believe you would have to do the following:
<logic:messagesPresent>
<html:messages id="errorMsg" header="errors.header"
footer="errors.footer"
property="org.apache.struts.action.GLOBAL_MESSAGE">
<ul><bean:write name="errorMsg"/></ul>
</html:messages>
</logic:messagesPresent>
rather than
<logic:messagesPresent>
<html:errors property="org.apache.struts.action.GLOBAL_MESSAGE"/>
</logic:messagesPresent>
As I said, I haven't tried them out yet - maybe someone who uses them can
confirm whether this is correct or not.
Niall
----- Original Message -----
From: "bOOyah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 23, 2004 12:49 PM
Subject: Re: ActionErrors in my JSP: how can I rewrite this RT snippet as
EL?
> Niall Pemberton wrote:
>
> > It should be
> >
> > <logic:present name="org.apache.struts.action.ERROR">
> > <html:errors property="org.apache.struts.action.GLOBAL_MESSAGE"/>
> > </logic:present>
> >
> > .. or even
> >
> > <logic:messagesPresent>
> > <html:errors property="org.apache.struts.action.GLOBAL_MESSAGE"/>
> > </logic:messagesPresent>
>
> Sorry for the delay in replying Niall...my wife MADE ME down tools for a
> day.
>
> Yes, indeed both your suggestions work perfectly. I'm using the 2nd
> one. Am I right then in guessing that
>
> <logic:messagesPresent>
> <html:messages property="org.apache.struts.action.GLOBAL_MESSAGE"/>
> </logic:messagesPresent>
>
> would display all messages (errors or otherwise)? Is it now that simple?
>
> What threw me originally is that 'org.apache.struts.action.ERROR' no
> longer exists in the online Struts javadocs. So I got embroiled in
> following the path of deprecation, and I couldn't get the current
> recommendations to work :-(
>
> Thanks a mill for your help.
>
> --
> bOOyah
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]