How to show next question from database on the click of next button..(Struts & Hibernate)

How to show next question from database on the click of next button..(Struts & Hibernate)

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

View Answers

December 1, 2011 at 4:28 PM









Related Tutorials/Questions & Answers:
How to show next question from database on the click of next button..(Struts & Hibernate)
How to show next question from database on the click of next button..(Struts & Hibernate)  Sir, I am facing this problem since 3 days.. I have.... Problem.: When m clicking my next button it is not showing another question
How to show next question from database on the click of next button..(Struts & Hibernate)
How to show next question from database on the click of next button..(Struts & Hibernate)  Sir, I am facing this problem since 3 days.. I have.... Problem.: When m clicking my next button it is not showing another question
Advertisements
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST,please send answer as soo as possible
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  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
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  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
How to Display Next question from database after clicking Next Button using "Arraylist concept"
How to Display Next question from database after clicking Next Button using... = null, question = null; Iterator...(); question
change database values when click next button on jsp page
change database values when click next button on jsp page  How to retrive database values rondomly and display jsp page ,when user click next and previous bottons change the values on jsp page
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.  Initially,display 7or10 records on a jsp pageand when click on the NEXT button(or href link) then display next 7 records
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript  when click on the next button/link then it must display next 10 record from database and same for previous
to display single row from database and next to display other question - JSP-Servlet
to display single row from database and next to display other question ... questions in database we have to display first question on clicking the button it has to display the next question. i tried it first question is displayed
next button in servlet
next button in servlet  i want to add next,previous button to get next record in my servlet. can you explain the logic to do
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon
pass radio button values to next page
pass radio button values to next page  how to pass selected radio button values which coming from mysql database to next page using php. Please show me with examples
How to load elements from db when i press next.
How to load elements from db when i press next.  Hello , I am working... but i want to show only 20 at the time and there will be 5 buttons for next page means when i click next, the next 20 books will be displayed from db on the same
how to make previous and next Button Display Data in php
how to make previous and next Button Display Data in php  <?php...); extract($_SESSION); /*$rs=mysql_query("select * from mst_question where test_id=$tid...;/p> $query="select * from mst_question"; $rs=mysqlquery("select * from
automatically move next page when data fetched from database is stored in text field
automatically move next page when data fetched from database is stored in text... from database and entered the next page should load without the user clicking on enter button. pls suggest me how to move next page without user clicking
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button...); } } }); } }   Here is a code that search the data from the database and show multiple identical rows from database on clicking search button
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button...); } } }); } }   Here is a code that search the data from the database and show multiple identical rows from database on clicking search button
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button...); } } }); } }   Here is a code that search the data from the database and show multiple identical rows from database on clicking search button
retrieve data from database in java swing form using prev n next buttons
retrieve data from database in java swing form using prev n next buttons  i have a database having columns id(int),path(text),width(int),height(int... of various rows from database in labels by clicking previous and next
retrieve data from database in java swing form using prev n next buttons
retrieve data from database in java swing form using prev n next buttons  i have a database having columns id(int),path(text),width(int),height(int... of various rows from database in labels by clicking previous and next
How to hide and show some field on a radio button click
How to hide and show some field on a radio button click  This is my... and cheque number label and textbox to be invisible when by cash radio button is clicked.and they should be visible when by cheque radio button is clicked. I have
How to show data from database in textbox in jsp
How to show data from database in textbox in jsp   How to show data from database in textbox in jsp   Here is an example that retrieve the particular record from the database and display it in textbox using JSP. <
in the below code two errors are there one at the button onclick atttibute and the next is at the next button
in the below code two errors are there one at the button onclick atttibute and the next is at the next button  <%@ page import="java.sql.*" %> function editRecord(id){ var f=document.form; f.method="post
how to get the next option - Java Beginners
how to get the next option  i was getting values from the database it was bulk so i want to keep the next option how to do in the jsp  ... by mistake. If you want to navigate the database data then you can visit
how to show image as a link which path coming from database
how to show image as a link which path coming from database   iam not getting proper answer for it. I am using netbeans .the url coming instring from database ,want to display as image on jsp . please help me
Time limit for a question from database injsp
the question and users answer these i want to add a time limit for a question which is fetched from database after the time over i want to show the next...Time limit for a question from database injsp  Hellu sir i am
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I... etc properly in the database,but what and how should i make
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I... etc properly in the database,but what and how should i make
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I... etc properly in the database,but what and how should i make
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I... entered task id,task name ,date etc properly in the database,but what and how
Hide/Show paragraph by button click
Hide/Show paragraph by button click In this tutorial, we will discuss about how to hide/show paragraph by clicking on button using jQuery. In the below... displays another button "click to show paragraph " .when we click
how to display records from database
records at a time and to use next and previous link buttons to show the remaining records if i click the previous button it should show the previous 20 records...how to display records from database  I want to display records from
JDBC Next
the front end and back end database. Loading a driver is the next step... to retrieve the record set from the database and the retrieve record set is assigned... JDBC Next      
how to show data in database ?
how to show data in database ?  how to show the data in the database to the user in the textbox so that user can modify it and save it again
how to show value and percentage in piechart sections from database using jfreechart
how to show value and percentage in piechart sections from database using jfreechart  Hii Sir, I made a pie chart from database using... = response.getOutputStream(); try { String query = "SELECT * from satya
Getting next Tag in the XML File
Getting next Tag in the XML File       This Example shows you how to get the next Tag from the XML... = reader.next():-By using this method we get the next parsing event.ADS
how to show effect (visual) on jsp page using value from database
how to show effect (visual) on jsp page using value from database  I am making a ticket booking system. I have a databse with a clumn "booking status... is "not_booked" then the picture shown as seat should be displayed red. Also i dont know how
How to call java method on Button click in jsp?
How to call java method on Button click in jsp?  How to call java method on Button click in jsp
how to retrieve image from mysql database using java and show it in HTML img tag ?
how to retrieve image from mysql database using java and show it in HTML img tag ?  how to retrieve image from mysql database using java and show it in HTML img tag
Show text by button click using jQuery
Show text by button click using jQuery In this tutorial, we will discuss about hide/show text by clicking on button. In the below example, there are two buttons : hide and show .The "hide " button is used to hide text
check radio button on retrieving the value from database.
information from database the i want to show cash radio button checked.How can i do...check radio button on retrieving the value from database.  HI i am... database and according to that i want to check the cash cheque radio button
How to get table row contents into next jsp page
How to get table row contents into next jsp page  Hi, I have a 30 radio button and values populating dynamically from the database.Now when i select a particular radio button and select on sub menu item , it goes to next jsp
how to retrieve text and images from mysql database and show on html page using jsp servlet
how to retrieve text and images from mysql database and show on html page using jsp servlet  <%@ page language="java" contentType="text/html... click
next and previous record in php
next and previous record in php  How to display next and previous records in PHP
ModuleNotFoundError: No module named 'next'
ModuleNotFoundError: No module named 'next'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'next' How to remove the ModuleNotFoundError: No module named 'next' error
avaudioplayer next track
avaudioplayer next track  How to set next and previous track in AVAudioPlayer in iPhone?   soundIndex=4; data=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[array objectAtIndex:soundIndex]] error
to renew leave to next month
to renew leave to next month  i need to make a project where... that leave in that particular month, it must be renewed to the next month so that he can apply leave for 2 days the next month
pass to next page
pass to next page  I am working on a school project no server client side only. 1st page you enter data such as name, address, DoB etc.(textboxes & dropdowns) after clicking submit the data needs to be displayed in a frame
On Click on Submit Button Display Data on Orderlist
On Click on Submit Button Display Data on Orderlist  How can retreive data from database on orderlist on Click on submit Button of same page

Ads