• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

validation

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
This tiny ad is guaranteed to be gluten free.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic