This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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
I agree. Here's the link:
subject: New to Struts and have basic question
It's not a secret anymore!