The honest truth is that the way the html:errors tag works is not
optimal. It encourages mixing HTML code in with the messages. The
messages really belong to the model and should not be mixed with
presentation code. The whole message resource thing is a standard Java
libary that can be used with any Java application. The html:errors tag
was left for backward-compatiblity, but moving forward designers should
avoid using it in favor of the message tags.

I should also mention that the html:message tags were predated by a set
of validator:message tags that can be used with Struts 1.0 applications.
See David's site. 

http://home.earthlink.net/~dwinterfeldt/

If someone wanted to pull these out and put them into a separate
library, it might be something we could distribute as a contribution for
the benefit of the 1.0 gang.

Meanwhile, although the tag is called "errors", it can really be used
for anything. Whether it's an error or confirmation message is something
user's can usually glean from the message itself. There's also any
number of things you can do with your own helper objects on this score:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg31271.html

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg31284.html

Joachim Gjesdal wrote:
> 
> hmm wouldn't there be nice to have something like:
> 
>   InfoMessages messages = new InfoMessages();
>   messages.add(InfoMessages.GLOBAL_ERROR, new InfoMessage("trans.generic.read_ok"));
>   saveMessages(request, messages);
> 
> then a tag that pics up whatever infomessages that are there:
> 
>   <html:info/>
> 
> should be easy to make and would work the same way as the html:error tag.
> 
> ---
> 
> Joachim
> 
> Ted Husted wrote:
> 
> >[since 1.1]
> >
> >
> >
> >>-----Original Message-----
> >>From: daniele rizzi
> >>Sent: Thursday, May 23, 2002 8:16 PM
> >>To: Struts Users Mailing List
> >>Subject: R: Do we have struts custom tag for success messages.
> >>
> >>yep, there is:
> >>
> >>a/ put this code somewhere in your Action.perform
> >>
> >>--- begin
> >>
> >>  ActionMessages messages = new ActionMessages();
> >>  messages.add("statusTrans", new ActionMessage("trans.generic.read_ok"));
> >>  saveMessages(request, messages);
> >>  return mapping.findForward(dest);
> >>
> >>--- end
> >>
> >>b/ put this other in .jsp
> >>
> >>--- begin
> >>     <p class="StrMessageOk">
> >>         <html:messages id="message" property="statusTrans" message="true">
> >>              <bean:write name="message"/><br>
> >>         </html:messages>
> >>    </p>
> >>
> >>--- end
> >>
> >>that's should be enough to show the 'trans.generic_read.ok' message when
> >>it's time.
> >>
> >>bye, d.rizzi
> >>
> >>-----Messaggio originale-----
> >>Da: Harinath [mailto:[EMAIL PROTECTED]]
> >>Inviato: giovedì 23 maggio 2002 15.22
> >>A: struts
> >>Oggetto: Do we have struts custom tag for success messages.
> >>
> >>Hi,
> >>
> >>As we have <html:errors/> for displaying error messages, do we have any
> >>custom tag in struts for success messages ?
> >>I need to display a success message to the user, when the request is
> >>processed successfully by the Action class.
> >>
> >>Regards,
> >>Hari
> >>
> >>
> >>
> >
> >
> >-- Ted Husted, Husted dot Com, Fairport NY US
> >-- Developing Java Web Applications with Struts
> >-- Tel: +1 585 737-3463
> >-- Web: http://husted.com/about/services
> >
> >--
> >To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to