• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation examples

 
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

Can anyone please suggest me with some examples of how to validate data on the server side. I tried out the Javascript and looked at some regex methods. The regex methods actually use methods from the class Pattern. I cannot find examples that uses Validator class. I was told to read the Javadocs but I am not able to understand how those methods work.

So I would appreciate if anyone could provide me with links to examples for validation at the server side.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Validator class? There isn't any Validator class in the Servlets Specification. Are you using a framework? If so, which one?
 
Nelo Angelo
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct, there are none in the Servlets specification.

I was asking about the one in "javax.xml.validation.*" package.

If this package is not discussed in the Servlets section would you please suggest me the methods/examples of Input/Data Validation in servlets.
 
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The javax.xml.validation.* package is for validating XML files against schema's

If you need to perform regular validation for a web application - you might have to choose from a host of third party validation frameworks available out there.

  • Apache - Validator
  • Spring Validator
  • Hibernate's Bean Validator (JSR-303)


  • Most of them provide plugability into most of the web frameworks.

    There is no standard way to validate data on the server side (as per the servlet specs) but most frameworks provide some sort of validation step (e.g. Struts 2 validation)
     
    reply
      Bookmark Topic Watch Topic
    • New Topic