• 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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
validation messages are printing twice. I have all properties of the form written in validation.xml and i also have a validate() method in Regionaloffersform.java
sample code:

ActionErrors errors = super.validate(mapping, request);
Validator v = Resources.initValidator("regionalOffersForm", this,
request.getSession().getServletContext(), request, errors, 1);
try {
v.validate();
} catch (org.apache.commons.validator.ValidatorException e) {
e.printStackTrace();
}

help me!!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Error messages are printing twice because you're generating them twice. If you're using the Struts Validator framework and your ActionForm extends ValidatorForm, there's no need to code a validate method at all. By calling super.validate and then writing code to validate, you're doing it twice.
[ June 26, 2008: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic