1 Reply Latest reply on Sep 25, 2007 6:25 AM by Pete Muir

    accessing facelet's source tag attributes

    Alexander Mashtakov Newbie

      Hi,

      After reading a bit about facelets source tags I decided to develop
      a small component to display prod. catalog:

      This is a facelet taglib snippet:


      <tag-name>pc</tag-name>
      ../test/page2.xhtml


      This is a snippet from page2.xhtml:

      <ui:component binding="#{pcBrowseTree.me}"
      xmlns="http://www.w3.org/1999/xhtml">


      <h2>#{title}</h2>

      ...


      </ui:component>


      And this is a tag usage snippet:

      <t:pc name="Browse for products" parent_id="14" />


      I'm trying to access parent_id property from pcBrowseTree bean, but with
      no success:

      FacesContext fctx = FacesContext.getCurrentInstance();
      Application app = fctx.getApplication();
      VariableResolver vr = app.getVariableResolver();
      log.debug(" - getVariableResolver(): " + vr);
      log.debug(" - variable resolved to: " + vr.resolveVariable(fctx, "parent_id"));

      The last line outputs null. In case if I replace "parent_id" to
      "facesContext" the variable is resolved.

      Is any way to access source tag's attributes from Java bean ?

      Thank you in advance,
      /Alexander