aspose file tools*
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
Author

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.

thanks.

raymond
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.

enjoy
http://www.onjava.com/pub/a/onjava/2002/12/11/jakartastruts.html?page=1


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

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: http://aspose.com/file-tools
 
subject: question on struts?