netfish wrote:
Hello,
I'm sure i'm missing something basic here.  I have a servlet that puts an
ArrayList into session say "EmployeeList" and this is my JSF snippet..
    <c:forEach var='item' items='${EmployeeList}'>
    <tr>
      <td><h:commandLink action='#{empInfo.getEmployeeInfo}'>
              <f:verbatim>${item.name}</f:verbatim>
              <f:param name="empId" value="${item.id}"/>
      </h:commandLink>
      </td>
      </c:forEach>

The EmployeeList has beans with id and name parameters.  I'm trying to post
an Id to the empInfo's getEmployeeInfo action method(empInfo is one of the
managed beans).  All i get is the "According to TLD or attribute directive
in tag file, attribute value does not accept any expressions" exception.  If
i however substitue the value to some static value, then it works just like
i need. FYI my tag libs include <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t" %>
and i'm using 1.1 implementation in Tomcat 5.5
Pls let me know if I'm missnig something here!?


Firstly, avoid using c:forEach with JSF1.1. The JSTL tags do NOT work well with JSF in general, and c:forEach is particularly incompatible (this is fixed with JSF1.2 I believe). Use t:dataList instead.

Secondly, the JSF tags don't accept JSP expressions ("${..}") in attributes, only the JSF "#{...}" form. For example, the myfaces_core.tld file has:

 <tag>
  <name>param</name>
  ....
  <attribute>
     <name>value</name>
     <required>true</required>
     <rtexprvalue>false</rtexprvalue>
     <type>java.lang.String</type>
     <description>The value of this parameter.</description>
  </attribute>
 </tag>

Note that rtexprvalue is false, ie no JSP expressions are permitted.

However the JSF form #{..} should be able to do what you want. Remember that JSF is not JSP. It's a different way of thinking, and just supports JSP as one of the possible "templating" systems.

Regards,

Simon

Reply via email to