4 Replies Latest reply on Jun 28, 2007 9:47 AM by Alex Savitsky

    s:decorate vs ui:decorate - different behavior for multiple

    Alex Savitsky Novice

      Are these two (Seam decorate tag and Facelets ui:decorate) supposed to be similar? For example, let's take the following template (taken from Seam docs) that decorates input fields with errors:

      template.xhtml:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:s="http://jboss.com/products/seam/taglib">
       <s:span style="#{invalid ? 'color:red' : ''}">
       <ui:insert name="label" />
       <s:span rendered="#{required}"> *</s:span>
       </s:span>
       <s:span>
       <s:validateAll>
       <ui:insert />
       </s:validateAll>
       </s:span>
      </ui:composition>


      When we're using ui:decorate, there are two columns created in the table, one for label, another one for input field (but no error decoration, obviously):

      <h:panelGrid columns="2">
       <ui:decorate id="username" template="template.xhtml">
       <ui:define name="label">Username:</ui:define>
       <h:inputText value="#{user.username}" required="true" />
       </ui:decorate>
      </h:panelGrid>


      When we're using s:decorate, it results in only one column being created, with both label and input field in it.

      <h:panelGrid columns="2">
       <s:decorate id="username" template="template.xhtml">
       <ui:define name="label">Username:</ui:define>
       <h:inputText value="#{user.username}" required="true" />
       </s:decorate>
      </h:panelGrid>


      Is this a desired behavior? I wonder whether s:decorate is supposed to behave the same way in respect to its child components...

      Alex