This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Brett Han
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!