Have you never developed using Dynamic Action Forms? With the vanilla Action Forms you may be right, but with Dynamic ones, I have found that Validator really cuts down the work.

Cheers

Christopher Marsh-Bourdon
www.marsh-bourdon.com
AIM: marshbourdon


On 13 Jul 2005, at 14:54, Larry Meadors wrote:

No offense (and not to sound like Mark Galbreath), but as a long time
struts user, I have never found validator to save time or code...not
even once.

Larry


On 7/13/05, Martin Gainty <[EMAIL PROTECTED]> wrote:

The Struts-validator will certainly be able to handle date- validation for
you
there is an excellent tutorial located at
http://www.oracle.com/technology/products/jdev/howtos/10g/ strutsvalidator/struts_validator_howto.html#setup
1)Add validator to your struts-config.xml
2)copy validator-rules.xml into WEB-INF/validator folder
3)copy predefined validator error messages from validator- rules.xml into your resources file (generally called ApplicationResources.properties) 4)Setup form beans to use the correct class..Notice the election between
static Form Beans and Dynamic Form Beans
to quote
when several forms reuse the same validation rules then use ValidatorForm the Action which is applicable in your case if you are using ActionMappings are applicable when differing rulesets apply to FormBean depending on which
Action is consuming the FormBean then use
ValidatorActionForm/DynaValidatorActionForm
5)setup validation rules in /WEB-INF/validator/validations.xml
there is a good primer available at
http://jakarta.apache.org/struts/userGuide/dev_validator.html

HTH,
Martin-
----- Original Message -----
From: "Lance Semmens" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Wednesday, July 13, 2005 7:17 AM
Subject: Invalid dates / numbers etc on forms


Is there a standard way of handling invalid user input in date / number
fields etc. I can forsee 2 possible solutions.
1. Declare date properties on your form as java.lang.Strings and
validate / parse them explicitely.
2. Declare date properties as java.util.Dates, have struts parse dates, check for null form properties and use request.getParameter() to see if
an invalid date was entered.

I prefer option 2. Are there any libraries around to do this generically
or another way that I haven't thought of? (NB i'm a newbie).

Thanks,
Lance.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to