Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 验证消息don';不显示单引号_Jsp_Spring Mvc_Hibernate Validator - Fatal编程技术网

Jsp 验证消息don';不显示单引号

Jsp 验证消息don';不显示单引号,jsp,spring-mvc,hibernate-validator,Jsp,Spring Mvc,Hibernate Validator,我正在测试Spring:MVC验证教程。我将hibernate验证器用作bean验证 @Min(value = 16, message = "Under 16 can't allow here.") @Max(value = 100, message = "You are too old.") private int age; 在我的JSP文件中 <div class="form-group"> <label class="contro

我正在测试Spring:MVC验证教程。我将hibernate验证器用作bean验证

@Min(value = 16, message = "Under 16 can't allow here.")
@Max(value = 100, message = "You are too old.")
private int age;
在我的JSP文件中

        <div class="form-group">
            <label class="control-label col-md-2 col-sm-2 col-md-offset-2">Age : </label>
            <div class="col-md-5 col-sm-5">
                <form:input path="age" class="form-control" cssStyle="width:50px" />
                <form:errors path="age" class="text-danger" />
            </div>              
        </div>  

年龄:
当填充值小于16时,验证错误消息不包括单引号(')。检查下面的屏幕截图

由于JSP、Hibernate或SpringMVC,我不确定哪个是错误。
如何解决显示单引号的问题?

使用“您需要使用”来逃避它。 因此,您的错误消息应该是“16岁以下的儿童在此不允许。”


要使用“您需要使用”来逃避它。 因此,您的错误消息应该是“16岁以下的儿童在此不允许。”


提交表单时,
BindingResult
包含哪些内容?每个错误都有类似于“默认消息”的内容和其他信息,用于对错误消息进行本地化。好的,我还建议您使用调试器逐步完成代码,并检查BindingResult和ConstraintViolation(异常)。如果潜在的约束不包含引用,我会感到惊讶。如果没有,您可能希望在Hibernate Validator中引发错误。我猜问题出在呈现代码的某个地方。提交表单时,
BindingResult
包含什么?每个错误都有类似于“默认消息”的内容和其他信息,用于对错误消息进行本地化。好的,我还建议您使用调试器逐步完成代码,并检查BindingResult和ConstraintViolation(异常)。如果潜在的约束不包含引用,我会感到惊讶。如果没有,您可能希望在Hibernate Validator中引发错误。我猜问题出在渲染代码的某个地方。