Hello,

unfortunately, the value attribute of h:outputText does not accept any 
rtexpressions.
In jsp 2.1 and if h:outputText would allow any expression you could write this:

<f:view>
   <h:form>
       <c:forEach items="${employeeBacking.employees}" var="emp" 
varStatus="status" >
           <h:outputText value="#{employeeBacking.employees[${status.index}]}" 
/>
       </c:forEach>
   </h:form>
</f:view>

In tobago you can write this:

<f:view>
   <t:page>
       <c:forEach items="${employeeBacking.employees}" var="emp" 
varStatus="status" >
           <t:out value="#{employeeBacking.employees[${status.index}]}" />
       </c:forEach>
   </t:page>
</f:view>

you can find a working example at

http://www.atanion.net/repos/asf/tobago/trunk in example/foreach


Bernd


Matt Raible wrote:
Unfortunately, JSP EL and JSF EL don't play nicely together. This will be fixed in JSF 1.2 with the Unified EL. In the meantime, here's a hack that should work:

<%-- Step 1: Use a non-displayed dataTable to pull userList into request --%> <h:dataTable var="employee" value="#{employeeBacking.employee}" style="display:none"/>

<c:forEach items="${employeeBacking.employees}" var="emp" varStatus="status">
            <c:out value="${status.index}"/><br/>
        </c:forEach

You could also use an h:dataTable to do the iteration.

Hope this helps,

Matt

On Aug 23, 2005, at 9:50 AM, Rick Reumann wrote:

I understand the below won't work as is without the backing bean put in scope with a useBean construct...but I'm more curious why I can not get c:out to evaluate (or really I should also just be able to use ${..} without the c:out since using tomcat5). What I end up getting is the literal text ${status.index} being displayed. I've tried with commons-el.jar and without and the same result:(
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<f:view>
    <h:form>
<c:forEach items="${employeeBacking.employees}" var="emp" varStatus="status">
            <c:out value="${status.index}"/><br/>
        </c:forEach>
    </h:form>
</f:view>




--
Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development
Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com
phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333

Reply via email to