3 Replies Latest reply on Feb 22, 2012 11:12 AM by clairelin

    s:decorate to ui:decorate migration

    abrods01

      I am trying to migrate from  Seam2 to Seam 3,one of issues is I have alot of forums which use s:decorate template like so:





      <ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                       xmlns:ui="http://java.sun.com/jsf/facelets"
                       xmlns:h="http://java.sun.com/jsf/html"
                       xmlns:f="http://java.sun.com/jsf/core"
                       xmlns:s="http://jboss.com/products/seam/taglib">
                       
          <div class="prop">
                      
              <s:label id="editLabel" styleClass="name #{invalid?'errors':''}">
                  <ui:insert name="label"/>
                  <s:span styleClass="required" rendered="#{required}">*</s:span>
              </s:label>
              
              <span id="editSpan" class="value #{invalid?'errors':''}">
                  <s:validateAll>
                      <ui:insert/>
                  </s:validateAll>
              </span>
              
              <s:message styleClass="error errors"/>        
      
          </div>
          
      </ui:composition>



      i have replaced s:decorate with ui:decorate, however how to replace s:message and required asterisk? Replacing with h:message doesn't work normally since it needs a 'for' field which is not being passed to the tablate,it seems. neither is

      #{required}

      being passed for the field.


      Thank you for your help, Alex


        • 1. Re: s:decorate to ui:decorate migration

          Hi Alex,

           

          I have the same problem now. May I know if you find the solution?

          • 2. Re: s:decorate to ui:decorate migration
            blabno

            IUse this:

            {code:xml}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"

                  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:c="http://java.sun.com/jsp/jstl/core">

            <head>

                <title>This will not be present in rendered output</title>

            </head>

             

            <body>

             

            <cc:interface componentType="org.jboss.seam.faces.component.UIInputContainer">

                <cc:attribute name="label" required="true"/>

                <cc:attribute name="ajax" required="false" default="false"/>

                <cc:attribute name="inputs" required="false" default="1"/>

                <cc:attribute name="rendered" required="false" type="java.lang.Boolean"/>

                <cc:attribute name="styleClass" required="false" type="java.lang.String"/>

            </cc:interface>

            <cc:implementation>

             

                <div class="prop#{empty cc.attrs.styleClass ? '' : ' '.concat(cc.attrs.styleClass)}#{cc.attrs.invalid ? ' errors' : ''}" id="#{cc.clientId}">

                    <h:outputLabel id="label" for="" value="#{cc.attrs.label}:" styleClass="label">

                        <h:panelGroup styleClass="required" rendered="#{cc.attrs.required}">*</h:panelGroup>

                    </h:outputLabel>

                     <span class="input">

                         <f:validateBean>

                             <h:panelGroup>

                                 <cc:insertChildren/>

                             </h:panelGroup>

                         </f:validateBean>

                     </span>

                    <h:panelGroup rendered="#{cc.attrs.invalid}" styleClass="messages">

                        <c:forEach var="i" begin="1" end="#{cc.attrs.inputs}">

                            <h:message id="message#{i}" for=""/>

                        </c:forEach>

                    </h:panelGroup>

                </div>

             

            </cc:implementation>

             

            </body>

             

            </html>{code:xml}

             


            • 3. Re: s:decorate to ui:decorate migration

              Hi,

               

              Thanks for your help.

               

              Br,

              Claire