Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I observed there is some difference between the validation_ruls.xml described in text books/URLs and the one , i just downloaded from commons URL..
For example, in the latest validation-rules.xml, it is mentioned like this

and in the textbooks and other URLs, it is mentioned like this

Here, I am confused about teh "classname" parameter ...
Please help in understanindg this.. Is this version problem or something else...
I am totally confused abt this
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The validator-rules.xml specifies which class and the methods within that class will be called for a particular rule. These methods contain the logic to perform the validation. The validator ships with the classname being: classname="org.apache.struts.validator.FieldChecks".
You can write your own validator though. The org.apache.struts.util.StrutsValidator class contains the methods for the validators that are included in the distribution. You should use these methods as your building blocks when writing your own method. I looks as if the second example you posted, a person wrote their own class called StrutsValidator and they wrote a method called validateRequired. This will get called for fields that are marked with "required".
So to make a long story short... the first one is standard and the second is one that somebody wrote for custom reasons.
A timing clock, fuse wire, high explosives and a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic