4 Replies Latest reply on Sep 30, 2010 2:26 PM by keith galligos

    messages do not display

    keith galligos Newbie
      When i searched the forum for this problem i found a few posts but none seemed to fit exactly what is happening with my app. I have paired my application down to one field on the page and a few java statements to remove the clutter. I am using jdk 1.5/Seam/Hibernate set up. I am have some java experience but very new to seam. I am trying to display an error message.....doesn't seem like much of a task. When I have <h:messages/> at the top of the xhtml the message appears at the top of the displayed page. When i remove <h:messages/> i get no message displayed. In the console i get the message: 11:13:53,236 INFO [lifecycle]
      WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=null[severity=(INFO 0), summary=(Billing Address cannot be removed), detail=(Billing Address cannot be removed)]. I think the issue is that the sourceid is null and is not presenting the id or key of the message to the xhtml so it can be paired up with the message i have defined.

      I am embarrased to say exactly how long i have fooled with this problem. I would certainly appreciate any help. I am new to the forum i guess i will paste the code into this message below instead of attach. There is not much to see:

      public void validateFFSCompany() {
      facesMessages.addToControl("test", "Billing Address cannot be removed");

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      <f:facet name="header">
      <hutputText value="Search Events"/>

      <fieldset style="width: 750px">

      <hutputLabel for="test" value="Test 1: "/>
      <h:inputText id="test" value="#{mailingAddress.line1}" size="35" maxlength="35" required="false"/>
      <h:message for="test" styleClass="message"/>

      <div class="spacer">
      <rich:spacer width="1" height="20"/>

      <h:commandButton value="Submit" id="submit" action="addFFSCompany" rendered="#{ffsCompany.id == 0}"/>
      <h:commandButton value="Edit" id="edit" action="editFFSCompany" rendered="#{ffsCompany.id != 0}"/>
      <s:button value="Cancel" id="cancel" action="cancelModifyFFSCompany"/>

        • 1. Re: messages do not display
          keith galligos Newbie

          Great question Keith. Why wouldn't such simple thing like displaying an error be so difficult. Didn't you say that code so similar, that could be said to be exact, works in another page in the same project?

          • 2. Re: messages do not display
            keith galligos Newbie
            Well, no I didn't say that. But, that is the case. Also, i changed the code to this for sending the message:

                Contexts.getConversationContext().set("modifyFFSCompany", null);  
                 //   String id = event.getComponent().getParent().getClientId(FacesContext.getCurrentInstance());
                    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "your message", null);
                    FacesContext.getCurrentInstance().addMessage("mtest", msg);

            Now i still get the warning message in the console, but it includes the component id now......see:

            12:22:15,970 INFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
            sourceId=mtest[severity=(ERROR 2), summary=(your message), detail=(your message)]
            • 3. Re: messages do not display
              keith galligos Newbie

              Brilliant attempt at fixing that message problem. So, now the message has a source id but it still is not hooking up with the component id on the xhtml page? Are you sure they are the same name.

              • 4. Re: messages do not display
                keith galligos Newbie

                Yes Keith, they are both mtest. I am using java and Seam Could that be the issue?