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

question on struts?

raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
Hi guys!!!
I'm studying struts now coz my next project will be done in struts.I've tried some tutorials in the net and found it easy and interesting to study.My question is this,if struts uses the ActionForm class to validate users input thru its validate method,would this be better to used rather than javascript?well, in javascript the validation is on the client while in struts you still need to submit it to the server.


Ram Kumar Subramaniam
Ranch Hand

Joined: Jan 17, 2003
Posts: 68
I guess this would a business decision or your decision.....
If you validate using javascript then validation would be fast but you would be depending a lot on the browser support(if browser does not support javascript ?? or javascript is disabled ??)
If you validate the same on the serverside using ActionForm etc.. your validation might be slow. Thats it.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561

The <validator> element also supports a <javascript> child element that allows you to specify a JavaScript function that can be executed on the client side. In this way, both server-side and client-side validation can be specified in a single location, making maintenance easier.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
prabhakar rao

Joined: May 17, 2003
Posts: 6
Validation can be done thru either client side or server side. But in struts, validations could be done thru ActionForm bean class. This is because, Just imagine like this, you have a login form, user enter a name and password. If the name and password is correct, then absolutely no problem he/she may get successfull page. But what will happen, if the password is wrong. This kind of validation can not be done thru java script. And also when the user click on loginAgain link then you should not diplay blank/empty in the user field. Instead of that you should dislay what he/she entered user name so that they can clarify if the user name is wrong or they enter only password and they can go to success page. This is what I understood from struts. If u want further details on this, refere some struts book or reply me so that I can send the code.
I agree. Here's the link:
subject: question on struts?
It's not a secret anymore!