?
Solved

Iteration loop counter in JSTL tag

Posted on 2011-10-20
5
Medium Priority
?
878 Views
Last Modified: 2012-05-12
<table class="TableBackgroundDB">
            <thead>
                    <tr class="TableHeaderRow">
                  <th>Name</th>
                  <th>Specification</th>
                </tr>
          </thead>      

                <c:forEach var="product" items="${res.product}" varStatus="rowCounter">
                <c:choose>
                      <c:when test="${rowCounter.count % 2 == 0}">
                        <c:set var="rowStyle" value="odd" />
                      </c:when>
                      <c:otherwise>
                        <c:set var="rowStyle" value="even" />
                      </c:otherwise>
              </c:choose>
                          
              <portlet:renderURL var="searchProductURL">
                <portlet:param name="action" value="viewProduct" />
                <portlet:param name="spec" value="${product.Specification}" />
                </portlet:renderURL>
               
                    <tr class="${rowStyle}">
                    <td><a href="${searchProductURL}">${product.name}</a><td>
                      <td>${product.Specification}</td>
                    </tr>
                    
                  </c:forEach>
          </table>
      </c:if>


output-  

Name    Specification
product                       product.ss1
0
Comment
Question by:Newton21205
  • 3
  • 2
5 Comments
 
LVL 16

Assisted Solution

by:Bryan Butler
Bryan Butler earned 2000 total points
ID: 37003529
Are you sure ${res.product} has more than the one product?  Can you output the values to check?
0
 

Author Comment

by:Newton21205
ID: 37003605
for now i have one product in database and im trying to display its properties in table format.
0
 

Author Comment

by:Newton21205
ID: 37003646
one product object in res.product. i'm trying to display properties of this object.
0
 
LVL 16

Accepted Solution

by:
Bryan Butler earned 2000 total points
ID: 37018300
items="${res.product}" must not be right.  What about just:

items="$res"
0
 

Author Closing Comment

by:Newton21205
ID: 37134673
solved
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question