Since client side validation is the best method to validate forms in web page, application designers usually try to get the javascript code from somewhere or write those lengthy codes themselves. Yesterday I was going through Struts complete reference and then Rahul Singh(neta) bumped in with a cool concept he learnt in HPES. I would love to share this information will you guys so here goes the description.
I was amazed to know this fact that we dont have to do even a single line of coding for javascript validation of forms. There is this
tag which dynamically generates javascipt functions for form validation.
For example:
If there is a login form then just make an entry in the validation.xml configuration file and also make an entry in the struts-config.xml. In the struts-config.xml file just make an extra parameter in the tag which is validate="true". In the validation.xml file make an entry for it.
Now finally insert the tag in the head section of the website in which the login page exist and your dynamic javascript code is ready to use.
Enjoyyyy!!