spring - 400 Bad request with Hibernate @Valid -


When I validate my form, I have a strange behavior.

As soon as I have a valid comment on Hibernate, Tomcat shares my request as "poor", if the posted data is not valid. . Data valid, no worries

I use:

  • Tomcat 7.0.52
  • Javax validation API 1.1.0.Final
  • Hibernate Verifier 5.1.0.Final
  • Spring 4.0.3.RELEASE

    At the moment, I do a very simple verification:

      Public class RemoveCacheElementForm {@NotBlank (message = "Please select a cache name.") Private string name; @notbank (message = "Please select the cash entry key.") Private string key;   

    Spring controller:

      / ** * Handler to remove a cached element from the specified cache. * * @ Return Back * / @RequestMapping (value = CACHE_REMOVE, method = RequestMethod.POST) Public string removalCachedElement (Model map model, @Valid @ModelAttribute (FORM_NAME) RemoveCacheElementForm form) {model.addAttribute ("removeElementResult", CacheUtils. removeCachedElement (form.getName (), form.getKey ())); InitializeModel (model); Return CACHE_ADMIN_PAGE; }   

    Whenever I delete the @Valit Annotation, there is no worry.

    Anyone have an idea?

    Thank you very much for your help! : -) Try changing your code for

    "itemprop =" text ">

      @RequestMapping (value = CACHE_REMOVE, method = RequestMethod.POST) public string removeCachedElement (Model map model, @Valid @ModelAttribute (FORM_NAME) RemoveCacheElementForm form, bindingResult bindingResult) {model.addAttribute ("removeElementResult", CacheUtils.removeCachedElement (form.getName (), Form .Copying ())); InitializeModel (model); Return CACHE_ADMIN_PAGE; }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -