File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Validation in sturts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation in sturts" Watch "Validation in sturts" New topic

Validation in sturts

Ad Rajesh

Joined: Apr 25, 2006
Posts: 21
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.

SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Validation in sturts
jQuery in Action, 3rd edition