Your property isn't really 'blah'. It is 'blah[0]',
'blah[1]', etc. So if you use the full property for a
field for the ActionErrors key, then you can retrieve
it next to each field.
ActionErrors errors = new ActionErrors();
errors.add("blah[0]", new ActionError("error.msg"));
<html:error property="blah[0]"/>
This type of question would be a good question to ask
on the Struts User list. And any development
suggestions are good to post to bugzilla if there
really is a feature request you want so they don't get
lost.
David
--- "Kerstetter, Shawn" <[EMAIL PROTECTED]> wrote:
>
> I have a form which contains 0 .. n "blah" text
> boxes all of which need to
> be validated for integer content on the server. If
> the ith, the jth and the
> kth elements fail validation, I would like to be
> able to present the error
> message "Invalid Number Format" next to the
> appropriate "blah" text boxes.
> My custom validation component is capable of
> tracking the index, but I don't
> see support for indexing in ActionError,
> ActionErrors or in ErrorTag. I am
> wondering how this case is normally handled in
> Struts.
>
> Currently, if I do:
>
> <html:error property="blah"/>
>
> for each blah form element I would get the error
> message repeated for each
> failure for each element.
> I need to be able to do something like the
> following:
>
> <html:error property="blah" index="<%= i %>"/>
>
> As a real world example, consider a "view cart" page
> in a typical ecom
> application, in which a customer would set the
> quantity to zero to remove
> one or more items from the cart. Now imagine that
> this user fat fingers the
> situation and enters something that is not a number
> in one of the quantity
> text boxes. Finally, imagine that I wanted to
> direct the user's attention
> to the offending row of the table with a friendly
> message.
>
> Thanks for any help,
>
> Shawn.
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>