• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts ValidWhen validation

 
Hiren Pathak
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
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.



But it doesnt work. Does anybody have any idea how can I achieve this ???

Thnx in advance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must confess to being a little disappointed in the validWhen validation rule. What you're allowed to put in the test expression is very limited, and does not include addition or subtraction.

I'd suggest writing your own custom validation rule for this.
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

jan
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys

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

regards
[ October 09, 2006: Message edited by: Manuel Jordan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic