Title: Message
Mike,
 
Thanks for your help. Setting it to Null didnt show me the message, but I guess I was erring somewhere. But ofcourse, I found the second approach more cleaner.
 
Regards
Bala
 
-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
Sent: Monday, August 15, 2005 12:05 PM
To: MyFaces Discussion; [EMAIL PROTECTED]
Subject: Re: Displaying Error Messages

You can either use "null" to specify a global error message, or you can set a binding on your "elementForm:elementTable" so that's it's available as a UIComponent element to your backing bean.   Once you've set up a binding, you can get the client id that way.

                          <h:dataTable id="
elementTable"
                               binding="#{page.
elementTableUIComponent}"

                facesContext.addMessage(
elementTableUIComponent.getClientId(facesContext),
                    new FacesMessage(...


On 8/15/05, Balaji Saranathan <[EMAIL PROTECTED]> wrote:

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.



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