1 Reply Latest reply on Dec 7, 2011 4:59 AM by Dee Kay

    Composite componente  does not evaluate attributes

    Dee Kay Newbie

      Hello *,

       

      i've written a composite component for having an alternative in Richfaces 4 for rich:spacer .

      Unfortunately the attributes and expressions are not evaluated.

       

      The output of

       

      <myspacer:spacer width="100" />

       

      is

       

      <h:graphicImage library="images" name="spacer.gif" width="px" />

       

      What's going wrong???

       

      Here the code of my component:

       

      <code>

      <!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:composite="http://java.sun.com/jsf/composite">

          <composite:interface >

              <composite:attribute name="width" default="0" type="java.lang.Integer"/>

              <composite:attribute name="height" default="0" type="java.lang.Integer"/>

          </composite:interface>

       

          <composite:implementation>

              <h:panelGroup rendered="#{cc.attrs.height > 0}">

                  <br/>

              </h:panelGroup>

              <h:graphicImage library="images" name="spacer.gif" width="#{cc.attrs.width}px" height="#{cc.attrs.height}px" />

          </composite:implementation>

      </html>

      </code>

       

       

      Thanks in advance

       

      Daniel

        • 1. Re: Composite componente  does not evaluate attributes
          Dee Kay Newbie

          Some more information:

           

          The attributes

           

          #{cc.attrs.width}

          #{cc.attrs.height}

           

          return consequently an empty String, the default value "0" as defined in the interface-part seems even not being set.

           

          However

           

          <h:outputText rendered="true" value="#{(cc.attrs.width+1)*8}=8" />

           

          shows

           

          8=8

           

          on the screen. So evaluation is done, but the attribute values aren't assigned......

           

          OMG