-1

in my scenario i have a code like below:

     <c:forEach items="${dbEntries}" var="c" varStatus="loop">
                    <tr> 
                          <% 
                              int i = 0;
                              System.out.println(i);
                          %>
                          <td rowspan="1">${c.getRh_name()}</td>                                 
                          <td rowspan="1">${c.getIpm_name()}</td>` 
                    </tr>
      </c:forEach>

now i want to access the variable from html. like below

<h1>${i}</h1>

but its not displaying.can anyone help??

Narendra
  • 1,511
  • 1
  • 10
  • 20

1 Answers1

0

Use jstl instead of java code inside jsp like this.

    <c:set var="salary" scope="session" value="${2000*2}" /> 
     <c:out value="${salary}" /> 
    <c:forEach begin="1" end="5" step="1">
         <c:set var="salary" value="${2000*2}" /> 
    </c:forEach> <c:out value="${salary}" />
Sanjay
  • 2,481
  • 1
  • 13
  • 28