Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation in sturts

 
Ad Rajesh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we perform validation for a field which hold three condition.
Condition: field1 should be 0 or between 100-200.
How can we perform validation for this situation.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts validation framework was designed to handle only basic, simple validations. Once you get into more complex scenarios, you generally have to write your own validation logic, either by extending the validate method of your ActionForm (you can still call super.validate() to have the rest of the framework validations performed), or by writing a custom validation rule.

Having said that,you might be able to use the validWhen rule for this. See the section entitled Designing Complex Validations with ValidWhen in this link.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic