Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 20th, 2006, 09:55 AM
Registered User
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please help my code is not giving me a result set

Please help my code is not giving me a result set for the search criteria ?
this is a bean i have written for the search criteria also attached is the code for the JSP page

 package diamx.admin; 
import java.io.*; 
import java.sql.*; 
import java.util.*; 

public class GuestData { 
   private Connection connection; 
   private Statement statement; 

   // construct TitlesBean object 
   public GuestData() throws Exception 
      // load the Cloudscape driver 

      // connect to the database 
     connection = DriverManager.getConnection( 

     statement = connection.createStatement(); 


  public List getGuestList() throws SQLException 
   //String track=guest.getTrackingNo("track"); 
      List guestList = new ArrayList(); 
GuestBean guest = new GuestBean(); 
      // obtain list of titles 
      String query="SELECT * FROM customer WHERE trackingNo='"+guest.getTrackingNo+"'"; 
ResultSet results = statement.executeQuery(query); 
while ( results.next() ) { 


          guestList.add( guest ); 
    return guestList; 

       protected void finalize() 
      // attempt to close database connection 
      try { 


      // process SQLException on close operation 
      catch ( SQLException sqlException ) { 
This is the jsp page code

<html xmlns = "http://www.w3.org/1999/xhtml"> 

      <title>Customer data</title> 

       <link rel = "stylesheet" href = "styles.css" 
         type = "text/css" /> 

      <p style = "font-size: 2em;">Customer Details</p> 

               <th style = "width: 100px;">Last name</th> 
               <th style = "width: 100px;">First name</th> 
               <th style = "width: 200px;">Tracking No</th> 
               <th style = "width: 100px;">Type of Parcel</th> 
               <th style = "width: 100px;">Destination</th> 
               <th style = "width: 300px;">Address</th> 
               <th style = "width: 100px;">Status</th> 
               <th style = "width: 100px;">Recievers Name</th> 
               <th style = "width: 200px;">Time Recieved</th> 
                <th style = "width: 200px;">Date Recieved</th> 


        <% // start scriptlet 

            List guestList = guestData.getGuestList(); 
            Iterator guestListIterator = guestList.iterator(); 
            GuestBean guest; 

            while ( guestListIterator.hasNext() ) { 
               guest = ( GuestBean ) guestListIterator.next(); 

         %> <%-- end scriptlet; insert fixed template data --%> 

                  <td><%= guest.getFirstname() %></td> 

                  <td><%= guest.getLastname() %></td> 


                        <%= guest.getTrackingNo() %></a> 
                  <td><%= guest.getParcel() %></td> 

                  <td><%= guest.getDestination() %></td> 


                        <%= guest.getAddress() %></a> 
                  <td><%= guest.getStatus() %></td> 

                  <td><%= guest.getReceiversname() %></td> 


                        <%= guest.getTimereceived() %></a> 
                   <td><%= guest.getDatereceived() %></td> 

         <% // continue scriptlet 

            } // end while 

         %> <%-- end scriptlet --%> 



stay alive

Similar Threads
Thread Thread Starter Forum Replies Last Post
ExecuteNonQuery not giving proper result Lalit Pradhan ASP.NET 2.0 Professional 6 July 24th, 2008 02:00 AM
getting a result set to a vector cakalanka Java Databases 1 March 24th, 2008 07:33 AM
This piece of code is giving an error sourik C# 2 July 15th, 2006 09:18 AM
write result set bmains SQL Server 2000 11 March 9th, 2004 09:31 AM
Result set jemacc SQL Server 2000 0 December 19th, 2003 07:26 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.