Clicky

<c:set var="count" value="0"/>
            <c:forEach var="software" items="${res.softwareList}" varStatus="count">
                  <tr class="${rowStyle}">
                  <td>${software.name}</a></td>
                <td>${software.description}</td>
            <c:set var="count" value="${count+1}"/>  <<<====== getting error here
         </c:forEach>


getting error:

asked 11/18/2011 12:23

Newton21205's gravatar image

Newton21205 ♦♦


4 Answers:
try this.
 <c:set var="count" value="${count}+1"/>
link

answered

chaituu's gravatar image

chaituu

give it a different name for varStatus other than count.checked it from my side and its working fine.



1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
<c:set var="count" value="0"/>
            <c:forEach var="itemName" items="${name}" varStatus="status">
                  <tr class="${rowStyle}">
                  <td>${itemName}</td>
                 
            <c:set var="count" value="${count + 1}" /> 
              <c:out  value="${status.count}" />
            		</tr>  
         </c:forEach>
link

answered 2011-11-18 at 18:47:48

chaituu's gravatar image

chaituu

If you want the number of items in your list, then you can use  
1:
2:
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<c:set var="count" value="${fn:length(res.softwareList)}"/>
link

answered 2011-11-19 at 04:30:25

rrz@871311's gravatar image

rrz@871311

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×14
×6

Asked: 11/18/2011 12:23

Seen: 253 times

Last updated: 11/30/2011 12:45