This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Server Side Validation questions 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 » Java » Java in General
Bookmark "Server Side Validation questions" Watch "Server Side Validation questions" New topic
Author

Server Side Validation questions

Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
I'm able to validate integers in Java SE 6 with Scanner hasNextInt.

I was curious if there is something similar that could validate for integers and alpha? Do you use regex to do this?

I'm able to validate null, and length values on the serverside. I'm moving on to validating alpha, numeric, and special characters. If there is a link to a FAQ or tutorial that would be great.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Not really a Servlet question, so moved to general Java.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
Thank you.

Just to update since it was moved:
I'm working with JSP/Servlets and trying to perform server side validation with integers, alpha, special char, email, etc.
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

I'm sorry, but I'm not understanding your problem.

For what I understood, this should help:


Validates only numbers and characters, but I believe that if you want to validate special characters, all you gotta do is to put those into the compile method, from Pattern.

About the e-mail validation, I believe that the best way to validate it is using regular expressions. Check the Pattern class doc for more information. It's all there.
Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
this is what i did:
 
jQuery in Action, 2nd edition
 
subject: Server Side Validation questions
 
Similar Threads
WA #1.....word association
reading integers from console into program
validation frame work
jQuery-How to highlight invalid input field value after getting validation error
Private Modifer