Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to Struts and have basic question

 
G.T. Reddy
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I am new to struts frame work.
My question is how to validate the jsp form in struts.Do we need to use client side java script or some other method.
Some one told that in FormBean we can do the validations.Please explain it.I don't know how to handle it.
thanks
gtr
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Form bean can do your basic validation. You can also use JavaScript but you should always think of JavaScript as a bonus. Never rely on the JavaScript having sent valid data since the user can copy the page and edit out the JavaScript if he really wants to. JavaScript should be a convenience to the user not the programmer.
If you don't want to write a Form bean for every JSP, then you can use the DyanActionForm to do basic validation.
Remember, the form should be doing only basic validation. There should be no database reads or complex business logic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic