- 
        1. Re: Validate Email Existancesivaprasad9394 Feb 12, 2013 1:40 AM (in response to wingman)Hi Boby, Using ajax u can validate it like below, <a4j:region> <h:panelGrid columns="5" border="0" columnClasses="fieldLabel,fieldColon,fieldData,fieldError,fieldErrorNone"> <h:outputText value="#{msg.username}" /> <h:outputText value=":" /> <h:inputText id="emailField1" value="#urBean.Email}" required="true" requiredMessage="#{msg.requiredField}" styleClass="cel" validatorMessage="#{msg.emailLengthMessage}" size="28" maxlength="15"> <f:validateLength minimum="#{msg.emailMin}" maximum="#{msg.emailMax}"> </f:validateLength> <a4j:support event="onblur" actionListener="#{urBean.emailActionListener}" reRender="p_emailField,eemailField" limitToList="true" /> </h:inputText> <h:outputText value="*" id ="erroremailField"/> <a4j:outputPanel id="p_emailField" > <h:message id="eemailField" for="emailField1" /> </a4j:outputPanel> </h:panelGrid> </a4j:region> public void emailActionListener(ActionEvent event) { log.info("Entering emailActionListener method()......"); Login login = new Login(); try { if (this.selectedUser != null) { ********** here check ur email with database you have already email existing or not **************** if (lst.size() > 0) { FacesContext faceContext = FacesContext.getCurrentInstance(); //Instead of doing like this create some boolean variable with false and set as true inside this method FacesMessage facesMessage = new FacesMessage();//if email already exist in the DB means and just render the <h:output text in the screen with color red. facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); // it shows like error in the screen. facesMessage.setDetail(this.Resources.getString("emailExist")); facesMessage.setSummary(this.Resources.getString("emailExist")); faceContext.addMessage("mainInclude:userAddAloneView:pageForm:emailField", facesMessage); } } } catch (Exception ex) { ex.printStackTrace(); } } If you are using richfaces 4 you can alter the code as u like using a4j:ajax and execute ...i hope it works. Thanks and Regards, Siva 
 
    