This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator framework" Watch "Struts Validator framework" New topic
Author

Struts Validator framework

Udaya Raj
Greenhorn

Joined: Nov 01, 2002
Posts: 26
Hi,

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

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


</form>

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
Sheriff

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts Validator framework
 
Similar Threads
Form validation not working
Need help with Validation.xml
Struts 2 - comparing dates in validation
Having problem with struts validator for error message
validation: replacing {0} with the value the user entered