我正在学习bean验证。我创建了带有用户名和密码输入字段的简单表单,这些输入字段通过支持bean绑定到模型(用户)属性用户名和密码。我与注释标记他们:h:消息没有输出
@Id
@NotNull(message="Username cannot be empty")
private String username;
@NotNull(message="Password cannot be empty")
private String password;
现在有了这种形式,我已经把<h:messages/>
内<h:form>...</h:form>
在页面上。我提交空表单,我被重定向到同一页面(我在支持bean的action方法中返回null),但没有消息正在显示。我究竟做错了什么?