Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help regarding struts validator framework (version 1.2.7)

 
Supreet Malaviya
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need help in using the struts validator framework.
In my project, I want to use struts validator framework for validation of various fields. The problem is that I have to use a single formbean across 3 JSPs.
What's happening is, when I try to add validator framework in the first JSP, the validator framework is trying to validate the fields present in the next JSP as well (as all the fields on the first and second JSP are in the same formbean) and hence starts throwing error for the fields which are on the second JSP (which will obviously be empty as I have not moved to the second page to fill up the data).
Can anyone tell me how to overcome this issue?

Thanks,
Supreet Malaviya.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To do this with XML-based validation you'd probably need to use validwhen. IMO this would be hard to maintain; it might be easier to do it in Java.
 
Supreet Malaviya
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

Thanks for your reply...
Can you please throw some light on how can we use "validwhen"?

Also, I understand that it will be easier to do in Java/using Action errors.... etc. but still would prefer to use validation.xml, if possible...

Thanks,
Supreet Malaviya.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://struts.apache.org/1.2.7/userGuide/dev_validator.html

Again, I think using it in this case is a *bad* idea.
 
Supreet Malaviya
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the help David...

Supreet Malaviya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic