facesContext.maximumSeverity==null not working on load for non richfaces components
its_me May 11, 2012 2:35 AMHi,
I have a search screen, with drop downs. The user can select the drop down values and hit search button. In case of any error, we have the following code in the catch block:
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, e.toString() + ".Exception occered while Getting details.\n",
e.getLocalizedMessage() + ".Exception occered while Getting details.\n"));
and our modal panel consisting of the error shows up:
<rich:modalPanel id="errMod" width="600" showWhenRendered="#{not (facesContext.maximumSeverity==null)}" style="padding: 0px;MARGIN: 0px;">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Error Status"></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<img src="#{facesContext.externalContext.requestContextPath}/images/close_icon.gif" id="errhidelink"/>
<rich:componentControl for="errMod" attachTo="errhidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<a4j:outputPanel id="errMPanel" ajaxRendered="true" style="padding: 0px;MARGIN: 0px;">
<rich:messages errorClass="errorStyle" globalOnly="true" showDetail="true"
fatalClass="fatalStyle" warnClass="warnStyle" infoClass="infoStyle" layout="list"></rich:messages>
</a4j:outputPanel>
</rich:modalPanel>
This works fine, if there is any error fetching anything displayed by rich/ ajax components.
The following is the code for the drop downs, which are displayed on load:
<h:selectOneMenu
id="myDropDown"
value="#{myBean.selectedName}"
styleClass="LiastDrpL" immediate="true" onchange="showData();" >
<f:selectItems
value="#{myBean.selectNameDropDown}" />
</h:selectOneMenu>
In case of any exception on load of these components, the modal panel does not show any error. The drop down is displayed as empty. We know that the exception is getting generated though, via the log file. Is there anything which we are missing? Isnt there any way to show error of the non richfaces/ a4j components on load?
Thanks and Regards,
Its Me......................