• 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

struts validator

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am new to Struts. I want to do validation by plugin struts validator. I googled and copied and pasted the following in struts-config file
<!-- Validator Configuration -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator/validator-rules.xml,/WEB-INF/validator/validations.xml"/>
</plug-in>

but I don't see any of these files under WEB-INF, I think I have to add some jar files.

Could you please help me how to get both the validator files in web-inf.

Thank you.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The validator-rules.xml file is provided by Struts, and contains the built-in validation rules. Formerly, you were expected to put this file in WEB-INF, but in verstion 1.3 and above, it's contained in the stuts-core-1.3.x.jar file, and you should reference it as: "/org/apache/struts/validator/validator-rules.xml". As long as the struts-core jar file is in your WEB-INF/lib folder, Struts will find it.

The validation.xml file, on the other hand is provided by you and contains the validation rules specific to your application. Just look in either the struts-examples or struts-blank war files that came with the download, and you'll find some examples that you can use as a template for yours. By convetion it's placed in WEB-INF/.
[ September 26, 2007: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic