Posted By:
Star_Plus
Posted On:
Wednesday, May 7, 2008 09:43 PM
I'm displaying list of records using . In one of the columns I have an input field to enter username, which is a mandatory field. What I want to do is when you process the data if the username is not entered display the error message on the relevant row. Following are the code snipets..... In the html page: value="#{varTransferTask.toUser}"> In the java page: public String doCompleteAction() { if (toUser == null || toUser.trim().length() == 0) { getFacesContext().addMessage( getToUser().getClientId(getFacesContext()), new FacesMessage("To user is required")); } //
More>>
I'm displaying list of records using . In one of the columns I have an input field to enter username, which is a mandatory field.
What I want to do is when you process the data if the username is not entered display the error message on the relevant row.
Following are the code snipets.....
In the html page:
value="#{varTransferTask.toUser}">
In the java page:
public String doCompleteAction() {
if (toUser == null || toUser.trim().length() == 0) {
getFacesContext().addMessage(
getToUser().getClientId(getFacesContext()),
new FacesMessage("To user is required"));
}
// If there are errors return to the same page
if (getFacesContext().getMessages().hasNext()) {
return "";
}
// Otherwise go to next page
return "complete";
}
Problem is error messages are not getting displayed even though it's returning back to the same page. I know facesContext still contain those messages when it returns to the same page as they get displayed when I use tag.
Can anybody please help me how to resolve this?
Thanks!