Hi Dave,
I came up with my own solution. Basically I wrote a method that I called
manually (i.e. I didnt use expressionvalidator annotation)..
in that method, i perform the check myself. If there was any error, I did
addFieldError("customers[index]", getText("some.text.from.properties.file
"));
then in the JSP, i have to put the fielderror in the right place.
e.g.:
<c:forEach begin="0" end="10" var="i">
<s:textfield key="customers[${i}].username" />
<s:textfield key="customers[${i}].age" />
<s:fielderrors>
<s:param>customers[index]</s:param> <%--- cant remember
the exact syntax.. its in their documentation --%>
</s:fielderrors>
</c:forEach>
I didnt use expressionvalidator annotation, since the attribute "message" is
compulsory. I dont want to set "message" attribute, since I am creating the
fielderror manually by hand (and I think the message will go to actionerrors
instead of fielderrors). Anyway, I hope that helps you out.
It is not the best solution.. so if you found a better way to do it, please
let me know.
On 3/14/07, Dave Newton <[EMAIL PROTECTED]> wrote:
--- Alex Wibowo <[EMAIL PROTECTED]> wrote:
> I am using Struts 2.0. Has anyone ever done
> validation on individual item in java.util.List
> before?
I'm drawing a blank on this one too after poking it
with a stick for about an hour now... I have a similar
requirement (but with fairly heavy inter-field
dependencies) so if you come up with something, please
follow up!
d.
____________________________________________________________________________________
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Best regards,
WiB
-------------------