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 March 8th, 2005, 08:08 AM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default retrieving from database... URGENT!!!

i'm trying to populate a drop down box with information from a database. the box populates but if i put in any code to try and capture the value i get a data not found error
here is the code:

<select name="race">
        <%
                  Statement statement = con.createStatement();
                   ResultSet rs = statement.executeQuery("SELECT race_number from race_info");
               while (rs.next())

            out.print("\t<option value = " + rs.getInt("race_number") + " >" + rs.getInt("race_number") + "</option>\n");
            out.print("</option>\n");

         %>
          </select>

i also tried to assign a temp value to race_number but that does not work either. Please HELP!!!

 
Old March 9th, 2005, 03:11 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I dont think you can read data directly from form elements, you need to sibmit the form to a second page that reads the parameters with getParameter, it is possible to submit JSP pages to themeselves, but then you have to handle two conditions, the initial condition with no data submitted and a second condition where parameters are read.






Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieving single value from database Moharo PHP How-To 2 July 5th, 2005 03:29 AM
NEED HELP! retrieving from database nvillare .NET Web Services 5 October 22nd, 2004 12:37 AM
URGENT:Retrieving data from the database jyoti_khera SQL Server ASP 1 October 21st, 2004 03:01 AM
problem retrieving from database rajuru Beginning PHP 2 October 8th, 2004 12:34 PM
NEED HELP! retrieving from database nvillare ADO.NET 1 December 2nd, 2003 10:31 AM





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