Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


JSP Form Validation

JSP Form Validation

JSP Form Validation

I want to create a JSP Form page (first.jsp) on Tomcat 4.1.27 with a form that has about 20 input entries where the form will validate all 20 fields and show validation errors on the same page as the original form page (first.jsp). For example, if someone has a blank entry on the Firstname field then it will show this message in red next to the field: First Name is required.

If the data passes the validations it will populate an Oracle database.

I was thinking of submitting the fields to a Controller servlet then use the Enumeration class to get all field values where I would check for blanks and valid email address. I assume I would not use a bean and have a getter and setter method for all 20 fields?

I dont have Struts and need to know the best way to do this.
Can anyone give me an example or ideas on this?

RE: JSP Form Validation

I think you should do the validation client-side with Javascript.


RE: JSP Form Validation

Thanks, some people turn off JavaScript in my environment which is why I want to do server side validation.

Please advise.

RE: JSP Form Validation

Look at Spring (and for this especially Spring MVC) ( http://www.springframework.org ). Makes validation a breeze (and integrates nicely with ORM tools like Hibernate and iBatis as well to make database access from your controllers smooth).

RE: JSP Form Validation

i don't know if this works.

after the validation,use request.getParameter (...) to get each value (meaning 20 of them), then insert the values into SQL into database.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close