Temoporarily suppress beanvalidation with JSF

六眼飞鱼酱① 提交于 2019-12-11 00:23:17

问题


i have a User class with a field for the e-mail-address and a password.

@NotNull
@Size(min=6)
@Pattern(flags=Pattern.Flag.CASE_INSENSITIVE ,regexp="[^ ]*")
private String password = null;

@NotNull) 
@Size(max=60) 
@EmailUse // Check if the email-address is already in the database
@Email
private String emailAddress = null;

This code works well at the registration. But when the user will edit his data i have a Problem with the Password and with the @EmailUse tag. The password is at the <h:inputSecret id="password" value="#{user.password}"/> empty so i became a problem with @NotNull. With the email address i have the problem that the email address from the user are already in the database but at this point is this no problem.

So my question is: Can i temporary disable this two checks?

Thank you very much for the help


回答1:


You can disable validation using <f:validateBean disabled="true"/>, example: http://relation.to/13317.lace

I hope this will be applicable in your case.



来源:https://stackoverflow.com/questions/2332713/temoporarily-suppress-beanvalidation-with-jsf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!