--- Alex Wibowo <[EMAIL PROTECTED]> wrote:
> It is not the best solution.. so if you found a
> better way to do it, please let me know.
I don't know if this is a "better way" or not and it
does not use annotations (at least not yet), but...
(1) Create a validation config file for the *object*
(in my case, DummyUser-validation.xml; I'm just
testing, and I'm a dummy :) - that's the object under
validation, not the Action.
(2) Annotate the Action's method as usual, but add a
@VisitorFieldValidator on the list of collections,
like so:
@Validations (
// Other validators, then:
visitorFields = {
@VisitorFieldValidator(
fieldName = "users",
message="",
appendPrefix=true
)})
This eliminates the need to manually insert the
<s:fielderror.../> element.
So my Action has a List<DummyUser> _users with
appropriate getter/setter. The VisitorFieldValidator
is validating on this object (the list) and by magic
knows what validation file to use (I'm assuming via
type; I currently have @Element specified but it's
probably not required:
@Element(value=DummyUser.class)
@CreateIfNull(value=true)
private List<DummyUser> _users = new
ArrayList<DummyUser>();
HTH,
d.
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]