Announcement Announcement Module
Collapse
No announcement yet.
How to acces HttpServletRequest from a Spring Validator clas Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to acces HttpServletRequest from a Spring Validator clas

    Hello,
    I'm new with spring and I currently learning the Validator part. I want in MyTestClass that implement Validator to access the HttpServletRequest.I also want to acces the Locale for some processing.

    Can somebofy give me some tip or references ?

    thx

  • #2
    Not sure why you'd want to do this. Spring is designed to separate the validation from the HttpServletRequest. You can then easily unit test your validator.

    Generally any Locale processing you need to be done can be done automatically by Spring if you register a custom property editor (e.g. Date and number formatting). Take a look at initBinder method of AbstractClinicForm of the Petclinic sample. This is where you can set the Locale for numbers, currencies and dates - let Spring do the type validation for you.

    Comment

    Working...
    X