• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One simple question - if my form bean is of the
DynaValidatorForm type in the struts-config.xml and
each propery of the form is specified in the
validation.xml, do I have to call the validate method
in the form bean? E.g. Do I still have to do the
following in my form bean that extends the ActionForm?
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


do I have to call the validate method in the form bean?


No. A struts validator is going to manage input validation for you.

Do I still have to do the following in my form bean that extends the ActionForm?


No. But if you want to use validate method in the form bean with the defined validators, your ActionErrors object under the validate method should invoke super.validate(mapping, request).
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The whole idea of having the DynaValidatorForm (sp?) as your FormBean instead of an ActionForm is so that you can manage all your validation requirements declaratively.
In the end, all validation is done either with the built-in validation functions, or custom ones if your application needs something additional that doesn't come out-of-the-box.
So, there's no source file for you to maintain (other than your struts-config.xml and whereever the validator functions are declared).
 
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic