This week's book giveaway is in the
We're giving away four copies of
Node.js in Action
and have Mike Cantelon, Marc Harter, T.J. Holowaychuk and Nathan Rajlich on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
Struts ValidWhen validation
Joined: Mar 24, 2003
Oct 06, 2006 08:48:00
I am using Struts Validation framework and I want to use strust validwhen condition.
I have beginYear and endYear. The difference between beginYear and endYear should be one. So i did something like this.
<var> <var-name>test</var-name> <var-value>((eYear - bYear) == 1)</var-value> </var>
But it doesnt work. Does anybody have any idea how can I achieve this ???
Thnx in advance
Joined: Feb 15, 2005
Oct 09, 2006 01:32:00
I must confess to being a little disappointed in the validWhen validation rule. What you're allowed to put in the
expression is very limited, and does not include addition or subtraction.
I'd suggest writing your own custom validation rule for this.
Joined: Feb 03, 2004
Oct 09, 2006 05:11:00
what came across my mind when i read you post (it has nothing to do with you question though, but might be worth considering)
are you sure you need _this_ validation? if i had the user to enter two years, and if one needs to be the following year of the other, i'd reduce user input to just one field
is that an option for you special case?
Joined: Sep 29, 2006
Oct 09, 2006 09:19:00
you can personalize your own type of exceptions (i.e. MyDateException) and could be throw from a BusinessObject (using the simple methods of class Date) (to compare 2 dates)
is only my suggestion
[ October 09, 2006: Message edited by: Manuel Jordan ]
kill your pride, share your knowledge with all
I agree. Here's the link:
subject: Struts ValidWhen validation
Limits of Validator Framework
Struts: validations using 'validwhen' in validation.xml
how to design this JSP. need ur suggestion
Struts Validation Problem
problem using validwhen and radio button
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014