This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Struts Validator framework
jQuery in Action, 3rd edition