Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Validator

 
Anoop Retnakumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a struts application in which all the client side validations are done using Validator framework. For mandatory checks i will get a alert message in an alert box. Now I need to replace this message box and I need to display the message in the JSP page itself just beside of the mandatory fields. Please help me in this regard.
Thank you
Regards
Anoop
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get an alert box, you use the <html:javascript> tag to generate the validation javascript, and in your form you use the onsubmit attribute to call the validate method. To do what you want, you have to have the following
1- Remove the onsubmit attribute from the html form
2- Make sure that you have validate="true" in the struts-config's action you want to validate
3- Make sure that the input attribute of that action points to the JSP
4- Use <html:errors> to display the errors on the JSP page
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic