我有一个传递给form()
的课程:
public static class Creation {
@Required(message = "Checkpoint name is required")
public String name;
@Required(message = "Longitude degrees are required")
public double longitudeDegrees;
@Required(message = "Longitude minutes are required")
public double longitudeMinutes;
@Required(message = "Latitude degrees are required")
public double latitudeDegrees;
@Required(message = "Latitude minutes are required")
public double latitudeMinutes;
@Required(message = "Message is required")
public String message;
@Required(message = "Points are required")
@Min(value= 1, message = "Points min. = 0")
public int points;
}
当我提交表格时,积分字段为空,我在表单错误中得到error.invalid
。如果我输入“0”,我会得到“Points min。= 0”错误。当字段为空时,我该怎么做才能获得“需要点数”消息?
答案 0 :(得分:0)
我找到了答案。将字段类型int
和double
更改为Integer
和Double
。