Hi,

Struts provides two ways to validate user's input.

The first one uses the validate() method on ActionForm. This method
has visibility on the fields of the form and should populate a list of
ActionError should there be any problem with the user's values. See
GuessActionForm.java for an example. Note also how to display these
errors using the "error" input in your stylesheets. See
guess-retry.xsl and the documentation here:

http://www.orbeon.com/oxf/doc/model2x-struts#N101F7

The second way is to use the client-side validation, using
Javascript. Struts helps you with templates (described in
validator-rules.xml and validation.xml). Since validation is done on
the client, you don't need to write Java code to validation, although
it's always a good idea to double check user's input, since client-side
validation could be fooled by a malevolent user.

To use client-side validation, you have to configure the validator
plugin in struts-config.xml, add your rules in validation.xml (a form
element with the required fields), and use the struts:javascript() tag
in your stylesheet. See jsType.xpl and the following URL for examples:

http://www.orbeon.com/oxf/doc/model2x-struts#N10330

Please let me know if I can be of further help.

Regards,
Julien


[EMAIL PROTECTED] wrote:


Hi,

I am new to Struts Validator Framework (But know the basics of Struts).

From where can I get a whole example (descriptive or in detail) of validating a
user's input etc. using Struts Validator Framework.

I am trying to use validation.xml, validator-rules.xml, struts-config.xml, an
ActionForm (subclassing ValidatorForm), an Action class (this is where I am
struck now --- I don't what is to be written there to validate the user's input)
and two JSPs (namely first.jsp -- which contains 2 fields viz., Phone and EMail
and a submit button ---- On clicking the submit button of first.jsp -- provided
the validations are successful, the user is redirected to second.jsp).

I am not clear on Action class part of code (validating user's input on Phone
and Email fields).

Request urgent help.  Any concrete example (Say just validating 2 input fields
using Validator Framework) would help me start quickly.

Regards,
S.Srikanth



_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users

_______________________________________________ oxf-users mailing list [EMAIL PROTECTED] http://mail.orbeon.com/mailman/listinfo/oxf-users

Reply via email to