I'm working on a social networking site and I want to print the 5 most popular people I follow.The result set is returning 5 most popular people I follow from database. I want the first one to be printed in an h1 heading, the second one in h2 and so on etc. My question is if there is any way to change the heading during the iteration without printing each result in if clauses.
Bellow is my code
<% ResultSet rs1 = dao.returnTop5(email);
int i = 1;
while (rs1.next()){
String username1 = rs1.getString("username");
String profilephoto = rs1.getString("profilephoto");
String followers = rs1.getString("followers"); %>
<img src="<%= profilephoto %>" class="first" title="<%= username1 %>">
<b><big>  <%= username1 %></a>
<h2 class="color">#<%= i %> (<%= followers %> Followers)</h2>
</big></b> <br> <% i++;
} %>
#<%= i %> (<%= followers %> Followers)
<% i++; } %> – Konstantina Papagiannopoulou Jan 15 '15 at 12:00