• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 1.2 - Client and Server-side validations

 
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Using the Validator framework in Struts, can we do client-side javascript validation(before submitting the form) and server-side validation(after submitting the form) to validate the fields in a form(eg: jsp)? If yes, then how? also please suggest an article/tutorial if possible.


Thanks.

 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any suggestions??
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jim Patrick wrote:Hi,

Using the Validator framework in Struts, can we do client-side javascript validation(before submitting the form) and server-side validation(after submitting the form) to validate the fields in a form(eg: jsp)? If yes, then how? also please suggest an article/tutorial if possible.


Thanks.



Check this link: Rose India _ Struts Validator framework.

Hope this helps!!
 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bharat..checked the link, but it only shows how to do the client side validation..my question was, how we can perform client-side as well as server-side validation at the same time using validator framework in struts.

 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim, I have not done this but let me tell you whatever i remember from some article few years ago. Unfortunately, i donot have the article or the link

From Struts 1.1 (i suppose), there is something called DynaValidatorForm is used for server side form validation. There should be a method in this API named validate with action mapping as a parameter.

in Struts1.2 also this is available, it sits below ActionForm in hierarchy and we got to extend this one instead of ActionForm and implement validate method in form and also set the "validate" attribute in action mapping to true and should work as intended.

Moreover, the validations mentioned in validation xml actually generates a javascript method in that particular JSP where the form is used. you can view such automatic js code by view source

May be if you google for dynaValidatorForm you might get more information.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic