Struts 2 Validation using Annotations

This post has moved here.

No Comments

  1. musachy says:

    by the way Struts 2 also supports some client-side validation. (set validate=”true” on the form tag)

  2. arsenalist says:

    If you’re referring to DWR thats hardly client side. It’s a matter of preference though, I think ‘Really easy field validation’ is too slick and easy to not be used.

  3. Dave says:

    The DWR isn’t, but the JavaScript validation is.

    It can also be very convenient to annotate the Action with validations rather than the bean, because different Actions may expect different bean data.

  4. Dean says:

    I’ll vouch for dexagogo. Struts should think about bringing that little project in…

  5. Mohana Priya says:

    @SkipValidation annotation on the action method doesnt work for me .Validation occurs for all the actions mapped to the same action class. Why so ?

  6. rangana says:

    I have 2 mothods caled edit() and create() I used annotation based validation
    but tthing is i want to validate some of experssions in edit method and some of the in create() method
    cant use @skipValidation in this
    my problem is i can not difine this seperatly in my actiion class ..both methods get validate from all expressions? any 1 have a ida?

  7. hildi says:

    Can we use annotation to dependents fields? For example, if we have to validate fields: “password” and “repeat password”, this values must be the same. How we can do it?
    Thanx!

  8. beeler4 says:

    Is there a way for the validation messages to be added the actionErrors instead of the field?

  9. starmer says:

    Hildi:
    @FieldExpressionValidator(expression = “(confirmPassword == password)”, fieldName = “confirmPassword”, message = “Passwords must match”)

  10. blackone says:

    password == passwordVerifier

  11. ichigo says:

    Can a message be parameterized in the key attribute?

    like:
    @RequiredFieldValidator(message=”", key=”required.field”)

    and the key with a param:
    required.field = The field {0} is required.

    how can I pass the param?

  12. bob says:

    aSlsnV hi good site thx http://peace.com