tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Lauman <jlau...@nwcascades.com>
Subject JSTL Question
Date Sun, 10 Apr 2005 20:37:11 GMT
I have the following 'working' code to produce a table.  The value of 
${param.field} determines which field will be displayed in column 3. 
Can I move this out of the c:forEach loop and assign a temp variable to 
it using c:if/c:set so that I only need to evaluate the value of 
${param.field} once and not on every line?  ${param.field} will always 
equal city, cuisine or name.

Thanks,

Jack

<c:forEach items="${restaurantInfo.restaurants}"
   var="restaurant">

<c:set target="${restaurant}"
   property="filterField" value="${param.field}" />
<c:if
   test="${fn:containsIgnoreCase(restaurant.filterValue, param.value)}">

......
<c:choose>
   <c:when
     test="${param.field eq 'city'}">

     <td width="79">
     <div align="left"><font size="1"
       face="Verdana, Arial, Helvetica, sans-serif">
     <c:out value="${restaurant.cuisine}" /> </font></div>
     </td>
   </c:when>

   <c:otherwise>
     <td width="79">
     <div align="left"><font size="1"
       face="Verdana, Arial, Helvetica, sans-serif">
     <c:out value="${restaurant.city}" /> </font></div>
     </td>
   </c:otherwise>
</c:choose>



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message