I have a textfield on jsf page , the onblur event of textfield calls a
backing bean method . This method in certain situation catches Exception and
calls FacesContext to render error message on jsf page. The problem is
message doesnt get render on to jsf page inspite of having h:message tag.
Here is the snippet
JSF page
<h:panelGrid columns="3" styleClass="detail" columnClasses="label" >
<h:outputLabel><h:outputText value="Property Tag" />
</h:outputLabel>
<h:inputText id="propertyTag"
value="#{deviceBean.tagNumber}" >
<a4j:support
action="#{deviceBean.loadAssetDetails}"
event="onblur" reRender="mypanel" />
</h:inputText>
<h:message id="propertyTagError" for="propertyTag"
styleClass="errorMessage" />
</h:panelGrid>
Backing Bean
public String loadAssetDetails() {
try{
namsAsset = deviceManager.getAssetDetails(sourceSystem, tagNumber);
//calls
database
}catch(RuntimeException re){
if (re.getMessage().contains("No Asset found")){
System.out.println("Inside Bean No
Asset Exception");
FacesContext.getCurrentInstance().addMessage("deviceForm:propertyTag", new
FacesMessage(FacesMessage.SEVERITY_ERROR, re.getMessage(),
re.getMessage()));
return null;
}
}
The log file prints the messages inside the catch block. But it doesnt get
render on JSF page. Any pointers/suggestions will be highly appreciated
--
View this message in context:
http://www.nabble.com/Unable-to-render-Error-Message-%3Ch%3Amessage%3E-on-JSF-page-tf4152824.html#a11814443
Sent from the MyFaces - Users mailing list archive at Nabble.com.