Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • 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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic