This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Validation in sturts
It's not a secret anymore!