title: JSF access to the "var" attribute value from dataTable from jsp
body: <p>I'm using JSF 1.1. I have a JSP page with a </p>
  
  <pre class="lang-html prettyprint-override"><code>    ....
      &lt;t:dataTable id="data"
         styleClass="scrollerTable"
         headerClass="standardTable_Header"
         footerClass="standardTable_Header"
         columnClasses="col1,col2,col3"
         var="product"
         value="#{beanProduct.listOfProducts}"
         preserveDataModel="false"
         rows="10"
      &gt;
      ....
  </code></pre>
  
  <p>The <code>#{product}</code> has a attribute named <code>state</code>. If its value is "pending", then I want to display a <code>&lt;h:commandButton&gt;</code>, else I display nothing.</p>
  
  <p>How can I get the value of <code>#{product.state}</code> in JSP scriptlet code?</p>
  
  <p>I tried the next:</p>
  
  <pre class="lang-html prettyprint-override"><code>    ....
      &lt;h:column&gt;
         &lt;f:facet name="header"&gt;
               &lt;h:outputText value="#{messages['list']}" /&gt;
         &lt;/f:facet&gt;
         &lt;%
             // ----&gt; In this point, I want know the value of "product.state"
         FacesContext context = FacesContext.getCurrentInstance();  
         Application app = context.getApplication();  
         ValueBinding binding = app.createValueBinding("#{product.state}"); 
         Object valueOfProduct = binding.getValue(context);
         String stateProduct = (String)valueOfProduct;
         if (stateProduct.equals("pending")) {
         %&gt;
         &lt;h:panelGrid&gt;
          &lt;h:commandButton value="Send" actionListener="#{beanProduct.Item}" action="#{beanProduct.sending"&gt;
          &lt;f:attribute name="idProduct" value="#{product.id}" /&gt;
              &lt;/h:commandButton&gt;
             &lt;/h:panelGrid&gt;
             &lt;%
             }
             else {
             %&gt;
             // Do nothing.
             &lt;%
         }
         %&gt;
      &lt;/h:column&gt;
  &lt;/t:dataTable&gt;
  </code></pre>
  
  <p>But it does not work. How can I achieve this?</p>