I\'m working on a JSF form prototype for inserting data into database table using AJAX data validation This is the JSF page:
Just add listener in your tag h:inputText
:
So you can check the entered value on the server side. When a user tabs out of the input field, JSF makes an ajax-call to the server and runs the name input component through the execute portion of the life cycle. This means that JSF will invoke the name input's value-change listener specified in attribute valueChangeListener
during the validations process phase of the life cycle.
And I would suggest to implement this method:
public void validateSessionid(ValueChangeEvent e) {
UIInput nameInput = e.getComponent()
String sessionid = nameInput.getValue()
//do SQL query
}
After the ajax-call returns JSF renders the h:outputText id="sessionidvalidate"
.