permaculture playing cards*
The moose likes Struts and the fly likes Help regarding struts validator framework (version 1.2.7) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help regarding struts validator framework (version 1.2.7)" Watch "Help regarding struts validator framework (version 1.2.7)" New topic
Author

Help regarding struts validator framework (version 1.2.7)

Supreet Malaviya
Greenhorn

Joined: Feb 07, 2008
Posts: 5
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Feb 07, 2008
Posts: 5
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Feb 07, 2008
Posts: 5
Thanks for all the help David...

Supreet Malaviya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help regarding struts validator framework (version 1.2.7)
 
Similar Threads
Double Validation problem in Struts
Query in Action Form
add struts plugin
Validator with Struts 1.0
Validating some extra fields of action form not in my jsp?