File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Validator framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator framework" Watch "Struts Validator framework" New topic

Struts Validator framework

Udaya Raj

Joined: Nov 01, 2002
Posts: 26

I have a form which has the date feild to be validated

<form name="formname">
<form-field property="dob" depends="date,dateRange">
<msg name="dateRange" key="errors.field.range3" />


I like to give different error message for failure in date and dateRange failure. We have a custom validator where we have implemented the validateDate and validateDateRange methods. There we get the error message Resources.getActionError(request,va, field)); I like to know how to get different messages.

IBM Certified WebSphere 4.0 Specialist<br />IBM Certified in OOAD and UML
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

You specify the error message in the "msg" attribute of the validator tag in the validator-rules.xml.

A good workman is known by his tools.
I agree. Here's the link:
subject: Struts Validator framework
It's not a secret anymore!