struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Barefoot" <Joe.Baref...@motiva.com>
Subject RE: does javascript have a place in mvc & struts
Date Mon, 28 Oct 2002 23:11:27 GMT
Not an elementary question at all, and the answer is:  It depends on the situation. ;)

First, your business requirements dictate where validation is possible.  If you are creating
a service-type web application accessible via the Internet to many different kinds of users,
then your business requirements may dictate that you must accomodate users who have JavaScript
disabled.  This means that you must always validate server-side even if you have "shortcut"
validation client-side w/ JavaScript, which will be used *if* JS is enabled.  

Even if it is specified that JavaScript is required for the application, you must ensure that
no illegal data slips through by doing server-side data checks, if necessary.

Second, the general notion is that 'simple' validation like password-length/format, zip code
length, phone number length/formats, etc., are best validated client-side with JavaScript.
 Anything that requires complex logic, business rule evaluation, or database access should
be validated server-side.  You should by no means transmit any sensitive information over
HTTP for client-side validation, of course.  What you really are trying to do is limit the
number of requests your server has to process by using JavaScript to validate the "easy stuff".

One good rule-o'-thumb, I feel, is that if you have to transmit a lot of extra hidden information
to do client-side validation with JS, then you should be doing it server-side instead.


peace,
Joe

> -----Original Message-----
> From: jmattucci@na.cokecce.com [mailto:jmattucci@na.cokecce.com]
> Sent: Monday, October 28, 2002 2:36 PM
> To: Struts Users Mailing List
> Subject: does javascript have a place in mvc & struts 
> 
> 
> Sorry this might be an elementary question, but im new to jsp 
> and struts.
> I have done a lot of reading in the last few weeks. I realize 
> that struts
> is the way to go in terms of following the mvc model. My one 
> question at
> this time is in regards to form validation. By that i mean when a user
> enters information; lets say username & password should the 
> information be
> validated with the aid of javascript on the client side or is 
> the concesus
> to leave such a task to beans on the server side???
> Thank u all for your time
> 
> **************************************************************
> **************************************************************
> *************************************************************
> 
> This message is intended for the use of the individual or 
> entity to which
> it is addressed and may contain information that is confidential and
> privileged and exempt from disclosure under applicable law.  
> If the reader
> of this message is not the intended recipient, you are hereby 
> notified that
> any dissemination, distribution, or copying of this communication is
> strictly prohibited.  If you have received this communication 
> in error,
> please contact the sender immediately and delete it from your system.
> Thank you
> **************************************************************
> **************************************************************
> *************************************************************
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message