• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

question on struts?

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What are you doing? You are supposed to be reading this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic