struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <>
Subject Re: ActionErrors in my JSP: how can I rewrite this RT snippet as EL?
Date Fri, 23 Apr 2004 16:31:05 GMT
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

* 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:

         <html:messages id="errorMsg" header="errors.header"

             <ul><bean:write name="errorMsg"/></ul>

rather than

        <html:errors  property="org.apache.struts.action.GLOBAL_MESSAGE"/>

As I said, I haven't tried them out yet - maybe someone who uses them can
confirm whether this is correct or not.


----- Original Message ----- 
From: "bOOyah" <>
To: <>
Sent: Friday, April 23, 2004 12:49 PM
Subject: Re: ActionErrors in my JSP: how can I rewrite this RT snippet as

> 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 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:
> For additional commands, e-mail:

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

View raw message