BeanClass code is:
public void validEmail(FacesContext context, UIComponent component,
Object value) throws Exception
{
//Set the email pattern string
Pattern p = Pattern.compile(".+@.+\\.[a-z]+");
//Match the given string with the pattern
Matcher m = p.matcher(email);
//check whether match is found
boolean matchFound = m.matches();
if (matchFound)
System.out.println("Valid Email Id.");
else
System.out.println("Invalid Email Id.");
}
.xhtml Code is:
<h:inputText title="Enter Email Address" value="#{registerBean.email}" id="eMail" required="true" validator="#{registerBean.validEmail}">
<rich:ajaxValidator event="oninputblur"/>
</h:inputText>
<rich:message for="eMail"/>
Exception is:
/Register.xhtml @68,138 validator="#{registerBean.validEmail}": java.lang.NullPointerException
How can i rectify this!