In this code how i will use arraylist(which store all my records in index form) to show next data on button click,so that it will goes to next list and sees the index and display another records Please reply.
</tr> <%if (pageName.equals("1")) {%> <tr> <td> <div style="height: 600px;overflow: auto;" > <table border="0" width="100%" align="left" height="100%"> <tr> <td width="20%" bgcolor="silver">Â </td> <td width="30%" height="30px" valign="center" align="center" background="http://www.widescreenbackgrounds.net/wallpapers/countryside-landscapes-landscape-desktop-images-widescreen-wallpapers.jpg"> <% String CardTopicId = request.getParameter("cardtopicId"); /*Getting Cards with the Particular TopicId*/ int a=Integer.parseInt(CardTopicId); List list1 = getCards.getCardsQuestionByTopicId(a); int Id1 = 0, count=1; String answer = null, question = null; Iterator iterator1 = list1.iterator(); if(iterator1.hasNext()) { Cards get1 = (Cards) iterator1.next(); Id1 = get1.getCardId(); question= get1.getQuestion(); answer = get1.getAnswer(); /*Getting Card with the particular TopicId Ends Here*/ int cardTopicid=Integer.parseInt(CardTopicId); int cardid=Id1; /*Comparing Card id with the Particular TopicId*/ List list = getCards.getCardsByTopicIdandCardId(cardTopicid,cardid); if (list.size() == 0) { %> <font size="9" color="red"><br><br><br><br>Â Â Â Â Â Â Sorry!No Question to view.</font> <% } else { int Id = 0; Iterator iterator = list.iterator(); if (iterator.hasNext()) { Cards get = (Cards) iterator.next(); Id = get.getCardId(); question= get.getQuestion(); answer = get.getAnswer(); /*Comparing Card id with the Particular TopicId Ends Here*/ %> <h1> Â Â <a href="flashPage.do?tid=<%=Id%>&pageName=2"><%=Id%><%=question%></a></h1> <a href="flashPage.do?cardid=<%=++Id1%>&pageName=1&cardtopicId=<%=CardTopicId%>"> <img src="images/next1.jpeg" width="90" height="30"/> </a> <% count++; } } } %> </td> <td width="20%" bgcolor="silver"> Â </td> </tr> </table> </div> </td> </tr> <% } else if(pageName.equals("2")) { %> <tr> <td> <div style="height:600px;overflow: auto;" > <table border="0" width="100%" align="left" heighT="100%"> <tr> <td width="20%" bgcolor="silver">Â </td> <td width="30%" height="30px" valign="center" align="center" background=""> <% String vid = request.getParameter("tid"); int id=Integer.parseInt(vid); List list = getCards.getCardsCardid(id); int Id = 0, count=1; String answer = null, question = null; Iterator iterator = list.iterator(); while (iterator.hasNext()) { Cards get = (Cards) iterator.next(); Id = get.getCardId(); question= get.getQuestion(); answer = get.getAnswer(); %> <h1> <font color="#00FF00" size="+5"> <font color="blue">Â Â </font><%=answer%></font></h1> <a href="flashPage.do?tid=<%=Id+1%>&pageName=3" > <img src="images/next1.jpeg" width="90" height="30"/> </a> <% count++; } %> </td> <td width="20%" bgcolor="silver"> Â </td> </tr> </table> </div> </td> </tr> <% } else if(pageName.equals("3")) { %> <tr> <td> <div style="height: 600px;overflow: auto;" > <table border="2" width="100%" align="left" heighT="100%"> <tr> <td width="20%" bgcolor="silver">Â </td> <td width="30%" height="30px" valign="center" align="center" background=""> <% String vid = request.getParameter("tid"); String zid = request.getParameter("cardtopicId"); int id=Integer.parseInt(vid); List list = getCards.getCardsCardid(id); if (list.size() == 0) { %> <font size="9" color="red"><br><br><br><br>Â Â Â Â Â Â Sorry!No Question to view.</font> <%} else { int Id = 0, count=1; String answer = null, question = null; Iterator iterator = list.iterator(); if (iterator.hasNext()) { Cards get = (Cards) iterator.next(); Id = get.getCardId(); question= get.getQuestion(); answer = get.getAnswer(); %> <h1> Â Â <a href="flashPage.do?tid=<%=Id%>&pageName=2"><%=question%></a></h1> <a href="flashPage.do?tid=<%=Id+1%>&pageName=3&cardtopicId=<%=zid%>" > <img src="images/next1.jpeg" width="90" height="30"/><h1> </h1> </a> <% count++; } } %> </td> <td width="20%" bgcolor="silver"> Â </td> </tr> </table> </div> </td> </tr>
Ads