Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


ashutosh singh
How to show next question from database on the click of next button..(Struts & Hibernate)
1 Answer(s)      2 years and 8 months ago
Posted in : Struts


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.


Advertisement
View Answers

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
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
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
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
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
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 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
JDBC Next
the front end and back end database. Loading a driver is the next step... set from the database and the retrieve record set is assigned in Result Set... JDBC Next      
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.   Xml
next and previous record in php
next and previous record in php  How to display next and previous records in PHP
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. <
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
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
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 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 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
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
Java Next()
Java Next()       In this section, you will get the detailed explanation about the next() method of interface Iterator. We are going to use next() method of interface Iterator
display all the values on next page
display all the values on next page  i am inserting values in the database through textboxes and dropboxes, when i am clicking on submit button those values are inserting in the database and i am moving on another page after
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
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
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
Java get Next Day
Java get Next Day       In this section, you will study how to get the next day in java... day. cal.get(Calendar.DAY_OF_WEEK)+1- This will return the next day. Here
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
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
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
Finding smallest value, then the next etc
Finding smallest value, then the next etc  hi, I know how to search for the smallest value index in an unsorted array so far with this: double... becomes true, I want to search for next smallest value that isn't the one I just
NEXT and PREVIOUS Records - JSP-Servlet
NEXT and PREVIOUS Records  Dear Sir, In my Project i have next... requirement next,previous buttons should be placed at top of the page as well. For Example: Previous Next sid sname addr 1
PHP Previous Next Page - PHP
PHP Previous Next Page  PHP Previous Next PageIs it possible to create dynamic navigation using PHP and MYSQL? DO I need to create a class to create the next, previous buttons in PHP? I?m digging for a small as well as handy code
Output Previous or Next Day of the Month
Output Previous or Next Day of the Month   Please Help! I need... they want the next day or the previous day. E.g., the user would see: Enter todays date(1-30): and after responding, the user would see: Do you want the next
Advertisements
 

 

 

DMCA.com