如果此值与来自数据库的值不匹配,我正在尝试突出显示p:inputText
(用于保存电子邮件地址)。这是我的java代码:
private UIInput gUiInputemailAdd; //global variable
public void validateCredentials(ComponentSystemEvent event) {
UIComponent components = event.getComponent();
UIInput uiInputemailAdd = (UIInput) components.findComponent("emailAdd");//ID of textbox
gUiInputemailAdd = uiInputemailAdd;
// uiInputemailAdd.setValid(false);//works fine here(it highlights this particular textBox)
}
public boolean forgotPasswordValidator(UserDetailTO userDetailTO)
throws MessagingException {
if (!gEmailAddress.equalsIgnoreCase(userDetailTO.getEmailAddress())) {
System.out.println(gUiInputemailAdd.getValue().toString()); //works fine and print value
gUiInputemailAdd.setValid(false);//doesn't work here
}
}
Xhtml代码: -
<p:outputLabel for="emailAdd" value="EmilAddresss" />
<p:inputText value="#{loginTo.emailAddress}" id="emailAdd"/>
请帮助我,我已经被困在这里这么久了。