1 Reply Latest reply on Aug 28, 2007 5:08 PM by pieter martin

    s:decorate with s:message not displaying

    pieter martin Newbie

      Hi,

      I am trying to display validation messages as per the documentation and the booking example.

      The ajax\hibernate validation works fine but when I check for duplicate manufacturer name on a form submit and add an error message to the injected facesMessages nothing gets displayed.

      if I add a <h:messages /> tag the message does however get displayed.

      I think that for some reason the <s:message /> tag in edit.html is not outing the message.

      Code follows...
      The session bean is a conversation scoped bean. The form submits calls the persist method.

      Any pointers as to what may be wrong?
      BTW it works fine in the booking example on the same instance of jboss.
      Thanks
      Pieter

      <navigation from-action="#{manufacturerManager.persist}">
       <rule if="#{manufacturerManager.manufacturerValid}">
       <end-conversation/>
       <redirect view-id="/chemical/manufacturers.xhtml" />
       </rule>
      </navigation>
      
      <s:decorate id="manufacturerNameDecorate" template="../layout/edit.xhtml">
       <ui:define name="label">Name:</ui:define>
       <h:inputText id="manufacturerNameId" value="#{editManufacturer.name}" required="true">
       <a:support event="onblur" reRender="manufacturerNameDecorate"/>
       </h:inputText>
      </s:decorate>
      
       // @End in pages with rule
       public void persist() {
       List<Manufacturer> existing = em
       .createQuery(
       "select m.name from Manufacturer m where m.name=#{editManufacturer.name}")
       .getResultList();
       if (existing.size() == 0) {
       em.persist(editManufacturer);
       manufacturerNameSearchString = editManufacturer.getName();
       events.raiseTransactionSuccessEvent("persistManufacturerSuccess");
       manufacturerValid = true;
       } else {
       facesMessages.addToControl("manufacturerNameId",
       "Manufacturer #{editManufacturer.name} already exists");
       manufacturerValid = false;
       }
       }


        • 1. Re: s:decorate with s:message not displaying
          pieter martin Newbie

          Problem solved!

          Had to do with my template.xhtml file.

          In it I have\had

           <f:subview rendered="#{identity.loggedIn and s:hasRole('FARMER') and s:hasRole('AGENT')}">
           <rich:panel>
           <h:panelGrid width="100%">
           <ui:include src="submenu.xhtml">
           <ui:param name="projectName" value="#{agentMasqueradeFarmer.username}"/>
           </ui:include>
           <ui:insert name="body"/>
           </h:panelGrid>
           </rich:panel>
           </f:subview>
           <f:subview rendered="#{not (identity.loggedIn and s:hasRole('FARMER') and s:hasRole('AGENT'))}">
           <ui:insert name="body"/>
           </f:subview>
          


          Removing the first <f:subview> makes <s:message> display the message.
          It seems having two f:subviews inserting (depending on mutually exclusive rendering rules) the same body confuses s:message.

          Course I too am confused.

          Whether this is a feature or a bug I dunno.

          Cheers
          Pieter