Java Script and Struts Validation
1 posts in topic
Flat View  Flat View

Posted By:   Abhay_Kumar
Posted On:   Monday, June 9, 2003 03:26 AM

Is it a good pratice to use Java Script when I am using a struts fame work. All my friends are of the opinion that One should avoid writing java script when using Struts.
Your Comments.


Re: Java Script and Struts Validation

Posted By:   Dermot_Hennessy  
Posted On:   Monday, June 9, 2003 03:44 AM

I don't think that the answer is as cut-and-dried as that. I have found that for speed it is not always a bad idea to let Javascript handle some form validation, such as, for example, determining whether a field has had legal characters entered into it. The thing about using Struts is that you are making a request back to the server every time you call a Struts tag. Sometimes that's just too expensive.

I recommend though, that if you're using Javascript for validation, you store it in a separate .js file and access it from your JSP, as opposed to inserting it in each JSP definition. This makes for clarity and a single point of update.


About | Sitemap | Contact