The validation and the related messages are on the domain objects and
not the action, so they are separate. Then the action defines which
domain object is validated via the visitor validation - there is also a
prefix (not sure of the exact attribute off hand), which would ensure
that coapp or primaryapp is used to differentiate the domain objects.
/Ian
j alex wrote:
Hi Ian,
>From the documentation, VisitorFieldValidator seems interesting. Can you
please provide some inputs on if/how we can use this for the following
scenario :
the domain object Name has properties firstname, lastname, initial etc.
now, Name could be associated with a primaryapplicant or a coapplicant
object.
In the JSP, we've s:text name="primaryapp.name.firstname" in the 1st page ;
and s:text name="coapp.name.firstname" in the next page.
How will i define a validation rule for the firstname field using
annotations which can be used for validating both these fields ; without
introducing any duplication. Also, i want to have the error message
customized so that if primary's name is invalid ; the msg should be "please
enter valid firstname for primary" and "please enter valid firstname for
coapp" if coapp name has an error.
I know this can be done easily in XML by having separate entries for primary
and coapp and using params to manipulate the error message accordingly.
Thanks,
Joseph
On 8/7/07, Ian Roughley <[EMAIL PROTECTED]> wrote:
And you can place them on the domain objects and use a visitor validator
;)
Dave Newton wrote:
--- j alex <[EMAIL PROTECTED]> wrote:
My understanding is that the validators are tied to
fields and not methods - right?
They *can* be tied to the fields (in other words,
every action method) but you can specify validations
based on the action name as well.
d.
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]