i have an xhtml like this:
<a4j:outputPanel id="displayGraph" layout="block" style="clear:both; margin-top: 0px; margin-left: 80px;margin-bottom: 20px;">
<a4j:mediaOutput element="img" cacheable="false" session="false" createContent="#{generateGraph.paint}" value="#{graph}" mimeType="image/png" standby="Loading" />
</a4j:outputPanel>
<a4j:outputPanel id="errorMessage" ajaxRendered="true">
<h:messages id="messages" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"/>
</a4j:outputPanel>
also i have paint method in backing bean which generates message if the method gives exception. like this:
public void paint(OutputStream os, Object data) {
try{
//some actions
} catch (IOException e) {
e.printStackTrace();
FacesMessages.instance().add(Severity.ERROR, "Sorry connection can not be achieved");
}
} else {
FacesMessages.instance().add(Severity.ERROR, "Sorry server does not exist");
}
}
now the messages are never shown. could anyone kindly tell me what i am doing wrong?
thanks in advance