通过JSF来抑制beanvalidation [英] Temoporarily suppress beanvalidation with JSF

查看:111
本文介绍了通过JSF来抑制beanvalidation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我有一个用户类,其中包含一个用于输入电子邮件地址和密码的字段。 $ b @Size(min = 6)
@Pattern(flags = Pattern.Flag.CASE_INSENSITIVE,regexp =[^] *)
private String password = null;

@NotNull)
@Size(max = 60)
@EmailUse //检查电子邮件地址是否已经在数据库中
@Email
private String emailAddress = null;

@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;

这段代码在注册时效果很好。但是当用户编辑他的数据时,我有一个密码问题和@EmailUse标签。密码位于< h:inputSecret id =passwordvalue =#{user.password}/> 空,所以我成了 @NotNull 。有了电子邮件地址,我有问题,用户的电子邮件地址已经在数据库中,但在这一点上是没有问题的。

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.

所以我的问题是:Can我暂时禁用这两项检查?

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

非常感谢您的帮助

Thank you very much for the help

推荐答案

您可以使用< f:validateBean disabled =true/> 禁用验证,例如: http://relation.to/13317.lace

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

我希望这会适用于您情况。

I hope this will be applicable in your case.

这篇关于通过JSF来抑制beanvalidation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆