<div> tag id repeats in while loop

I am developing a small web application using JSP, was successful in retrieving the data and my task is to group the data under tabs using bootstrap tabbed menu. The real task is to display the data based on the tab click. But when i try to display more then one row in single tab, it is displaying only the last row (value). Its because the div tag id is getting repeated. Please find the below code and tell me where i had done the mistake.( i want to group the id if it repeats, but i am unable to find it)

My HTML CODE:

while (rs1.next()) {
                    PositionID = rs1.getString(1);
                    PositionTitle = rs1.getString(2);
                    StudentID = rs1.getString(7);
                    Bio = rs1.getString(10);
                    ProfileID = rs1.getString(11);
        %>

            <div class="tab-pane fade active in" id="<%=PositionTitle%>">
                <%

                %>
                <div class="col-md-5">
                    <input type="radio" name="<%=ProfileID%>"
                        value="<%=ProfileID%>"><%=FirstName%>,
                    <%=LastName%><br>
                </div>

            </div>


            <%




                    }
                %>
                </div>
            <%

                    connection.close();
                    }

                    catch (Exception e) {
                        e.printStackTrace(response.getWriter());
                    }
                %>

This is the inspect element snap shot, based the code the id is getting repeated


Source: jsp

Leave a Reply