Sunday, 15 May 2011

playframework - Play Framework Bean Validation of Primitive Types -


I am using the following class to validate a form submission described here:

When I do bindFromRequest () the mandatory obstacle is ignored. However, it works when I change the primitive type into a box type:

  public class exampleForm {@interpreted public integer height; Public string payload; }  

Is Bean Validation not working with primitive types? Explanation is easy: the database allows zero values, and not the primitive type.

@ mandatory checks that if object is zero the first step is no more interval.

Place both models and forms in the form of the rule of using integer instead of int and you will always work your validator as expected.


No comments:

Post a Comment