You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Slattery, Tim - BLS" <Sl...@bls.gov> on 2004/02/10 16:46:44 UTC

Errors or messages or??

I'm still trying to figure out the new method for reporting errors to the
user. We  create an ActionMessage (instead of an ActionError), we add that
to an ActionMessages object (instead of ActionErrors) and we use
<html:messages...> in the JSP instead of <html:errors...>. Right so far?

In the javadoc for the Action object, it shows a saveMessages method. The
description says:

Save the specified messages keys into the appropriate request attribute for
use by the <html:messages> tag (if messages="true" is set), if any messages
are required. Otherwise, ensure that the request attribute is not created. 

What's this about "messages=true"? Where does that get set? 

--
Tim Slattery
Slattery_T@bls.gov


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Errors or messages or??

Posted by Hubert Rabago <ja...@yahoo.com>.
With Struts 1.1, we have support for both error messages and non-error
messages.  We use saveMessages() for non-error and saveErrors() for error
messages.  In our JSPs, we can use the <html:messages> tag to display them:

        <html:messages id="message" message="true">
            <bean:write name="message"/><br>
        </html:messages>

        <html:messages id="error" message="false">
            <bean:write name="error"/><br>
        </html:messages>

The <html:messages> tag gives <bean:write> access to the individual messages
(you can specify a property name for more specific messages).  To
differentiate error and non-error messages, you set the "message" attribute. 
It defaults to false (IIRC), so <html:messages id="error"> ...
</html:messages> will iterate through the error messages.

Hope that didn't get you even more confused.  =)

- Hubert

--- "Slattery, Tim - BLS" <Sl...@bls.gov> wrote:
> I'm still trying to figure out the new method for reporting errors to the
> user. We  create an ActionMessage (instead of an ActionError), we add that
> to an ActionMessages object (instead of ActionErrors) and we use
> <html:messages...> in the JSP instead of <html:errors...>. Right so far?
> 
> In the javadoc for the Action object, it shows a saveMessages method. The
> description says:
> 
> Save the specified messages keys into the appropriate request attribute for
> use by the <html:messages> tag (if messages="true" is set), if any messages
> are required. Otherwise, ensure that the request attribute is not created. 
> 
> What's this about "messages=true"? Where does that get set? 
> 
> --
> Tim Slattery
> Slattery_T@bls.gov
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org