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.
Thanks for the reply, but my problem is I want to display the error message for the full phone number only once. As the the phone number is captured in separate fields I getting the error message four times.
Any help will be appreciated.
Joined: Feb 15, 2005
If you use the Struts validation framework and define four fields, you're going to get four error messages. There's no way around this with the "out of the box" validation framework.
You have 2 choices:
1-Remove the validation rules for all four fields. Then override the validate() method of your ActionForm. Manually code the logic for this validation, then call super.validate() to handle the other validation framework validations.
2-Create a custom validation rule that will handle this situation.
This link gives an example of how to code a custom validation rule.