File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes efficiency of struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "efficiency of struts validation" Watch "efficiency of struts validation" New topic

efficiency of struts validation

Sudarshan Sreenivasan
Ranch Hand

Joined: Jun 28, 2007
Posts: 188

Hi All,
The struts validation causes a server hit even for validation that can be done on the client end , is'nt this going to prove too costly for most applications ?

Even the so called client side validation reaches upto the controller which is essentially a server side component , so according to me it is also not of much help !

Please can some one throw some light on this aspect

Thanks in advance
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

Struts provides an option to do both client (JavaScript) and server (Java.) It generates JavaScript to validate all the form fields in the browser when the user clicks submit. If you have this option set, the server validation would just run if the user turns off JavaScript.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One further point: Struts 1 client-side validation does not make any calls to the server while validating. It is all set up before the page is rendered in JavaScript functions. When the user actually clicks the submit button, the client-side validations are all handled via local JavaScript calls that do not access the server.

Consultant, Sima Solutions
I agree. Here's the link:
subject: efficiency of struts validation
It's not a secret anymore!