The string you pass into ActionError must be a key
from your message resource property file.  Otherwise
the property for error messages is just a key to look
up messages and the convention is to make it match the
property name.

<html:errors name="fooBean" property="bar.foo[3].xyz">

errors.add ("bar.foo[3].xyz", 
   new ActionErrorError ("error.required");

error.required="The field is required."


This is more of user list question than a dev list one
so I've copied the user list.

David

--- Henry Mugasha <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> Does the current stable struts release support
> assigning errors to
> nested indexed propertys of ActionForms?
> 
> 
> For example,
> I have an ActionForm called fooBean with the
> property bar that is a class with a reference to the
> collection whose reference is foo and each item in
> the collection has a property xyz.
> 
> I want to access the errors assigned to this
> property (by the validate method of the fooBean
> ActionForm) like so:
> 
>  <html:errors name="fooBean"
> property="bar.foo[3].xyz">
> 
> 
> If this feature is supported, how does one set the
> ActionError?
> 
> I tried 
> 
> ...
> ActionErrors errors = new ActionErrors();
> ...
> errors.add ("bar.foo[3].xyz", 
>              new ActionErrorError ( " error string "
> );
> 
> 
> but this failed to show any error messages.
> 
> The point of this is to show error messages against
> each form field
> in stead of showing all error messages at the top of
> form with
> <html:errors/>.
> 
> Any help,suggestions,ideas are highly appreciated.
> 
> Thanks
> 
> Henry
> 
> 
> Make a difference, help support the relief efforts
> in the U.S.
> http://clubs.lycos.com/live/events/september11.asp


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com

Reply via email to