Ray,

You need to set the client id when adding the message
to FacesContext.

The last line in your code example would be...
context.addMessage("myClientId", message);

Your JSP messages tag would be...
<h:messages id="myClientId" layout="table"
styleClass="message" showSummary="true"
showDetail="false"/>

Hope this helps.

Rob Breidecker




--- Ray Clark <[EMAIL PROTECTED]> wrote:
> I have a method in a managed bean that is getting
> called.  I wish to put a message on the page to
> inform
> the user that the operation that he/she requested
> was
> performed correctly.  I can successfully do this
> with
> a variable in the managed bean.  My problem is that
> I
> was wanting to use the built in FacesMessage class
> for
> this if possible.  Here is my code to add my
> message:
> 
> FacesMessage message = new FacesMessage();
> message.setSeverity(FacesMessage.SEVERITY_ERROR);
> message.setSummary("Add was successful");
> message.setDetail("Add was successful");
> FacesContext context =
> FacesContext.getCurrentInstance();
> context.addMessage(null, message);
> 
> It does add the message to the context because I can
> use System.out to print it out right after that. 
> The
> problem is that the message doesn't display on the
> page.  I do get other Faces messages displayed so I
> don't believe it is a problem with the JSP.  I'm
> wondering if FacesMessage was not designed to be
> used
> like this.  Is FacesMessage only designed to be used
> in the converter and validator?
> 
> Has anyone else been able to put a message in the
> context and been able to print it out on the page?
> 
> Here is my JSP snippet.
> 
> <h:messages layout="table" styleClass="message"
> showSummary="true" showDetail="false"/>
> <h:messages layout="table" styleClass="message"
> showSummary="false" showDetail="true"/>
> 
> 
> Thanks,
> Ray
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Make Yahoo! your home page 
> http://www.yahoo.com/r/hs
> 


                
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs

Reply via email to