my dog learned polymorphism*
The moose likes Struts and the fly likes New to Struts and have basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "New to Struts and have basic question" Watch "New to Struts and have basic question" New topic

New to Struts and have basic question

G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
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.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
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.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
It is sorta covered in the JavaRanch Style Guide.
subject: New to Struts and have basic question
Similar Threads
Is it worth it?
forward a page to some action
Eclipse ganymede Does it support struts 1.1
Accessing Struts form in javascript?
what should i use in jsp for displaying multiple records?