4 Replies Latest reply on May 2, 2008 1:11 AM by Maximiliano Carrizo

    EL & Facelets problem - parameters not working?

    Tom Tamulewicz Newbie

      Relatively new to the entire JSF/Facelets/Seam world, so your patience is appreciated.


      I have a template put together to wrap h:commandLink.  The template I put together is below.


      <ui:component>
        <c:if test="#{empty rendered}">
          <c:set var="rendered" value="true" />
        </c:if>
        <c:if test="#{empty action}">
          <c:set var="action" value="default" />
        </c:if>

        <h:commandLink rendered="#{rendered}"
            action="#{componentUtils.invokeAction(action)}" value="#{value}" >
            <ui:insert />
        </h:commandLink>
       
      </ui:component>


      I was using this in a page as follows:


      <mr:commandLink value="Test Link"            action="@cfgRecallSessionAction.execute(element)}"
      rendered="#{element.isRecallable() == true}"/>


      This works. 


      If I don't include the == true part and only rely on the boolean expression, it doesn't work.  It appears that the parameter isn't being passed to the template and the <c:if test="#{empty rendered}"> is always evaluating to true, setting the default value for rendering to true.  Adding more to my confusion, if I drop out the c:if to assert a default rendered value, then the rendered value makes it's way into my template correctly without the == true part in my calling page.  The last wrinkle is that if the rendered value in the calling page is a fixed value, it all works. 


      Does this make sense?  I'm trying to leverage templates as a replacement for all of the components I use and this behavior isn't making it easier.


      Another problem I'm running into is with a similar template wrapping s:link. 


      <a4j:repeat value="#{featureList.features}" var="feature" >
      <mr:link viewID="#{feature.viewId}" value="#{feature.title}" />
      <br/> </a4j:repeat>


      When using this template, the viewID comes through as null, yet the value comes through properly.  I'm likely missing something basic in the way this is supposed to work together, but haven't been able to flush it out after several frustrating days.


      Thanks for the help.