Sir,
I am facing this problem since 3 days..
I have 2 tables. Cards and CardTopics. cardtopic(field) is common to both the tables.
Problem.: When m clicking my next button it is not showing another question from "cards" table.
passing parameter from viewalllists.jsp to flashPage.jsp
<td>Â <%=description%></td> <%-- <td>Â </td> --%> <td class="vtd" align="center" > <a href="ListPage.do?pageName=2&iid=<%=Id%>"><img src="images/edit-icon.png" title="Click Here To Update This Lists" alt="Click Here To Update This Stream"></a> Â Â Â Â <a href="deleteList.do?method=deleteLists&id=<%=Id%>"><img src="images/delete-icon.png" title="Click Here To Delete This Cards" alt="Click Here To Delete This Cards"></a> Â Â Â Â <a href="flashPage.do?cardtopicId=<%=Id%>&tname=<%=topicname%>&pageName=1"><img src="images/play.jpg" width="32" height="32"/></a> </td> </tr> <%count++; } } %>
next jsp called:flashPage.jsp
<%-- Document : home Created on : 23 Mar, 2011, 12:00:22 PM Author : Ashutosh --%> <%@page import="com.ebhasin.flashcards.beans.Cards"%> <%@page import="java.util.Iterator"%> <%@page import="java.util.List"%> <jsp:useBean id="getCards" class="com.ebhasin.flashcards.daos.viewAllCardsService"/> <% /***************************************** Session Login Details Start Here ***********************************/ String userName = (String) session.getAttribute("userName"); String password = (String) session.getAttribute("password"); Integer loginId = (Integer) session.getAttribute("loginId"); Integer userTypeId = (Integer) session.getAttribute("userTypeId"); if ((userName == null) || (password == null) || (loginId == null) || (userTypeId == null)) { %> <jsp:forward page="index.jsp"/> <% } else { /***************************************** Session Login details End Here ***********************************/ String pageName = request.getParameter("pageName"); if (pageName == null || pageName.equals("")) { %> <jsp:forward page="index.jsp"/> <% } %> <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <!-- header page includes here --> <html:html lang="true"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <table border="1" width="100%" height="100%"> <tr> <td height="10%" bgcolor="silver" align="Right"> <font size="6">Welcome <font color="green"> <%=userName%></font> </font> Â Â Â Â Â </td> </tr> <tr> <td height="6%" align="center"> <tiles:insert page="/jsps/menu.jsp" flush="true"/> </td> </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 Id 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="http://www.bestclipart.net/wp-content/uploads/2011/09/Background-Images-3.jpg"> <% 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="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 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> <%}%> <tr> <td height="10%" bgcolor="silver" align="center">CopyWrite@ebhasin</td> </tr> </table> </body> </html:html> <%}%>
PLEASE PLEASE !! TELL ME ITS SOLUTIONS. my email address is: ashutosh10g@gmail.com
Ads