I tried the example from the HelpTagsErrorsAndMessages.html in my jsp
near the top of the body.
<logic:messagesPresent>
<h3><font color="red"></font>Messages:</h3>
<ul>
<html:messages id="msg">
<li><bean:write name="msg" /></li>
</html:messages>
</ul>
</logic:messagesPresent>
The action that forwards to that jsp has:
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_MESSAGE, new
ActionMessage("error.detail",retStatus));
this.saveErrors(request, errors);
where retStatus is a string.
And in my ApplicationResources.properties I have
error.detail={0}
But when I run it I get
org.apache.jasper.JasperException: Cannot find bean msg in any scope
...
----- Root Cause -----
javax.servlet.ServletException: Cannot find bean msg in any scope
...
Michael Oliver
CTO
Alarius Systems LLC
3325 N. Nellis Blvd, #1
Las Vegas, NV 89115
Phone:(702)643-7425
Fax:(702)974-0341
*Note new email changed from [EMAIL PROTECTED]
-----Original Message-----
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 12:28 PM
To: Struts Users Mailing List
Subject: Re: Html:messages vs html:errors
>From this and other messages I think you've got the wrong end of the
stick
regarding the <html:errors> tag. You can use either <html:errors> or
<html:messages> with ActionMessage, its just down to personal
preference.
I've added a page comparing <html:errors> and <html:messages> here:
http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html
You can use either
As for the validate method in your action form - then whether you use
<html:errors> or <html:messages> the you can do something like the
following...
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (<some conditon here>) {
errors.add("myProperty", new ActionMessage("myProperty.error"));
}
return errors;
}
Niall
----- Original Message -----
From: "Fergal O'Shea" <[EMAIL PROTECTED]>
To: "'Riyaz Mansoor'" <[EMAIL PROTECTED]>; "'Struts Users Mailing List'"
<[email protected]>
Sent: Tuesday, April 05, 2005 5:21 PM
Subject: RE: Html:messages vs html:errors
>
> We don't seem to have struts-examples.war readily available here at
work.
>
> Does anyone have an example of overriding an ActionForm's validate()
method,
> but using ActionMessage instead of ActionError (I presume you still
have
to
> use a Collection of ActionErrors), and using html:messages instead of
simple
> old <html:errors/>.
> Specifically, how does one tie in the id parameter in html:messages
with
the
> ActionErrors Collection returned by one's validate() method ?
---------------------------------------------------------------------
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]