struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bOOyah <boo...@nowhere.org>
Subject Re: [slightly OT] Any advice for 'jsp.error.useBean.duplicate' ?
Date Sat, 10 Apr 2004 01:42:02 GMT
Curtis Taylor wrote:

> You're creating the bean "status" in the varStatus declaration in your 
> c:forEach action. It's in scope in the loop as "status" already, so you 
> don't need to re-initialize it. You can access its attributes inside 
> your loop:
> 
> <c:out value="$status.begin" />
> <c:out value="$status.count" />
> <c:out value="$status.index" />
> 
> ...etc.
*sigh*  You are, of course, correct.  I could have sworn I tried that. 
I certainly swore.

> Just curious; what're you trying to do inside the loop?
The old 'alternating-table-row-color' trick.

<c:forEach items="${ScheduleDetailsForm.eventsList}"
         var="event"
         varStatus="status">

   <c:choose>
     <c:when test="${status.count%2 == 0}">
       <%-- set style for EVEN rows --%>
   <c:otherwise>
       <%-- set style for ODD rows --%>
   </c:choose>

</c:forEach


No doubt there's a better way of doing that too.

Many thanks Curtis.

-- 
bOOyah


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


Mime
View raw message