• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Help regarding struts validator framework (version 1.2.7)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the help David...

Supreet Malaviya
 
What's brown and sticky? ... a stick. Or a tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic