java - How to set the <%= ...> in to a loop counter? -


i want ask question jsp. writing following code in jsp page. however, when set <%= obj.getcounter()%> (use-defined method) loop counter, found not work. can me? thank you.

the following code.

<% private int looptime = <%= obj.getcounter()%>; %>  <% for(int i=0; i<looptime; i++) { %> <tr>     <td><%= obj.getname() %></td>     <td><%= obj.getage() %></td> </tr> <%}%> 

you can't include 1 scriptlet inside another: what's point?

<% int looptime = obj.getcounter(); %> 

is wanted? i'm asking because looptime isn't 'loop counter' in code, it's loop upper boundary.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -