Announcement Announcement Module
Collapse
No announcement yet.
Serial No Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial No

    Hi all,
    I have one query regarding displaying serial number in the jsp. I want the serial number to be generated in the jsp itself. I am using
    Code:
    <c:forEach var="video" items="${command.videoList}" varStatus="status"> 
    <c:out value="${status.count}"/>
    </c:forEach>
    But I am using a condition. Like the one below:

    Code:
    <c:choose>
    								<c:when test="${video.startTime == null}">
    	<td class="left"><c:out value="${status.count}"/></td>   
    	<td class="right"><b>Subtotal:</b></td>  
    	<td class="left"><c:out value="${video.subTotal}"/></td> 
    	</c:when>
    	<c:otherwise>
    	<td class="left"><c:out value="${status.count}"/></td>  
                 <td class="left"><c:out value="${video.startTime}"/></td>
    	<td class="left"><c:out value="${video.duration}"/></td>
    	</c:otherwise>
    	</c:choose>
    The display is like this now:
    HTML Code:
    slno start         duration
    1    00:00:05    00:00:45
    2    00:00:33    00:00:10
    3    Subtotal     00:00:55
    4    00:10:05    00:01:00
    5    00:55:08    00:02:00
    6    Subtotal     00:03:00
    In the above I don't want serial numbers for subtotal to be displayed. Here for e.g. 3 and 6. And the serial numbers has to be continued for next row, I mean sl no 3 for start 00:10:05 and so on.

    Please help me in solving this.
    Thanks in advance

  • #2
    Please anybody...

    Comment


    • #3
      Unfortunatly I don't think you're going to be able to use the status variable if you want to maintain continuation. One way of doing this obviously would be to maintain your own counter.

      Code:
      <c:set var="slno" value="1"/>
      <c:forEach var="video" items="${command.videoList}"> 
      <c:choose>
      <c:when test="${video.startTime == null}">
      	<td class="left">&nbsp;</td>   
      	<td class="right"><b>Subtotal:</b></td>
      	<td class="left"><c:out value="${video.subTotal}"/></td> 
      </c:when>
      <c:otherwise>
      	<td class="left"><c:out value="${slno}"/></td>  
      	<td class="left"><c:out value="${video.startTime}"/></td>
      	<td class="left"><c:out value="${video.duration}"/></td>
      	<c:set var="slno" value="${slno + 1}"/> 
      </c:otherwise>
      </c:choose>
      </c:forEach>

      Comment

      Working...
      X