This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 1.2 - Client and Server-side validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.2 - Client and Server-side validations" Watch "Struts 1.2 - Client and Server-side validations" New topic
Author

Struts 1.2 - Client and Server-side validations

Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

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

Joined: Dec 27, 2005
Posts: 42

any suggestions??
Bharat Chowdary
Greenhorn

Joined: Feb 13, 2011
Posts: 7
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

Joined: Dec 27, 2005
Posts: 42

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.

Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

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.


Have Fun with Java
little,little.. little by little makes a lot..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1.2 - Client and Server-side validations
 
Similar Threads
client side validation vs server side validation
struts validator
Validation in Struts
Strage: DynaValidatorActionForm vs DynaValidatorForm
Validation in Spring