This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
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

Typical/Built-in way to do validate different sets of parameters?

 
Brett Han
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm hoping this is a common struts problem as well.

I have a Struts form that users can use to generate reports, based on data they input. The problem is that they can input different sets of data.

For example, assume the form contains fields A through F.

The following may be valid input sets:

1. A, B, and C
2. Just D
3. A, D, and E
4. B and F

and so on.

So the user must enter non-null values - and sometimes more constrained values like integers - for one of the given sets above. So if he only entered values in, say, C, E, and F, I should display an error.

and so on.

I could write error-checking rules either in the associated action or in the validate method on the form bean, but this is already getting really messy and more inputs could be added later on.

Is there a common way in struts to deal with validation on different input sets like this? Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic