一个Wicket验证示例 wicket验证
程序员文章站
2022-03-09 14:07:07
...
Java文件:
I18nResources.properties文件:
add(new RequiredMaxLengthTextField("name", new PropertyModel<String>(getData(), "name")).add(new AbstractValidator<String>() { @Override protected void onValidate(IValidatable<String> validatable) { final String groupname = validatable.getValue(); if (groupname == null) { return; } getData().setName(groupname); if (groupDao.doesGroupnameAlreadyExist(getData()) == true) { error(validatable); } } @Override protected String resourceKey() { return "group.error.groupnameAlreadyExists"; } }));
I18nResources.properties文件:
group.error.groupnameAlreadyExists=Group name already exists.
上一篇: JBoss AS 6 m3 发布!