This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Server Side Validation questions  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 67239
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really a Servlet question, so moved to general Java.
 
Ricky Jay
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 95
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is what i did:
 
Villains always have antidotes. They're funny that way. Here's an antidote disquised as a tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!