Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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 ]
 
Is that a spider in your hair? Here, threaten it with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!