Title: Displaying Error Messages

Hi,

I'm trying to understand how to display error messages that are indication of some exception cases in the Backing Bean.

There is no validation involved, but I would like to show up an error message telling the user that a "Delete action on the table row " has failed.

I use the FacesContext.addMessage - but this takes the clientID as the argument. Is it always necessary to harcode this id in the Backing Bean?

My code looks like this
    <h:form id="elementForm">
        <h:message for="elementTable" showDetail="true" showSummary="true" errorStyle="color:red" />           
        <h:dataTable id="elementTable"
                ……

And in the handler where the exception is thrown
      catch (NoObjectFoundException exception)
      {
         FacesContext.getCurrentInstance().addMessage("elementForm:elementTable",
                     new FacesMessage("The Object does not exist .Unable to delete the specified row. Please check the \n"

                     + "logs for detailed error message !!!" ));
         return null;
      }

Thanks
Balaji



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.

Reply via email to