这是我的formbean:-
public class LoginFormBean {
@NotEmpty
private String userId;
@NotEmpty
private String password;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String pass) {
this.password = pass;
}
}
在我的 message.properties 文件中我写: -
NotEmpty={0} must not empty.
它向我显示错误消息:userId must not empty.
和password must not empty.
但我想将错误消息显示为User Id must not empty.
或'Password must not
empty.'
我知道我可以@NotEmpty(message="User Id must not empty")
在我的 formBean 中使用,但我想要同步消息,就好像我们需要更改消息一样,它会减少开销。
我搜索了 JSR 文档,但没有找到任何东西来替换我的属性userId
名称User Id
。请大家帮助我,从两天开始就卡住了。
如果不可能,请告诉我,或者如果不能,请帮助我做些其他的事情。
谢谢沙姆斯
_