Solved

what is the wrong in my code?why the radio options do not appear?

Posted on 2007-11-24
1
247 Views
Last Modified: 2010-04-01
Hi
what is the wrong in my code?why the radio options do not appear?
I checked the value and it is correct,so why the values do not appear in options

(see the radio options in the code)
<%@page contentType="text/html"%>

<%@page pageEncoding="UTF-8"%>

<%@ page import="java.sql.*,java.io.*,java.util.*,org.apache.*,java.io.File,java.lang.*"%>

<%--

The taglib directive below imports the JSTL library. If you uncomment it,

you must also add the JSTL library to the project. The Add Library... action

on Libraries node in Projects view can be used to add the JSTL 1.1 library.

--%>

<%--

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 

--%>
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

   "http://www.w3.org/TR/html4/loose.dtd">
 

<html>

    

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>JSP Page</title>

    </head>

    <body>
 

    <h1></h1>

     <form method="POST" action="accept.jsp"  >

      <table align="center" border="3" title="requested Software">

            <tr >

                <td></td>  <td width="200" bgcolor="#B3104D">Software name</td> <td width="300" bgcolor="#B3104D">Software description</td>

            </tr>

   

      

            <% 

            HttpSession s = request.getSession();

            try{

            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

            Connection conn = DriverManager.getConnection(

            "jdbc:odbc:NN_project","sa","nnproject");

            

            

            int i=0;

            

            String str= null;

            

            Statement stmt = conn.createStatement();

            String sql = "SELECT * FROM soft_temp  ";

            ResultSet rs = stmt.executeQuery(sql);

            //ar=rs.getArray("NN_type_name");

            

            

            while(rs.next())

            {

           

            %>

            <tr>

                    <td> <input type="radio" name="software" value="<%= rs.getString("software_name")%>" /> </td>

                    

                            <td>

                               

                           <%= rs.getString("software_name")%> 

                            

               </td>

                            

            </tr>

            <% out.println("\n");%>

            <%           

            } 

            stmt.close();

            } catch (Exception ex) {

            ex.printStackTrace();}

           

            %> 

        </table>

    

        <input type="submit" value="Accept" />

        <input type="button" value="Reject" align="center" onclick="top.location='reject.jsp'"/>

      

    </form>

   

    </body>

</html>

Open in new window

0
Comment
Question by:master_programmer
1 Comment
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 20344099
You get the same field twice with rs.getString.  The second time, it doesn't exist.  You should have a SQLException in your logs -- if you check, it will tell you the line number of your file which has the problem.

Change your code to something like this:
  String myVar = rs.getString("software_name");

and use <%=myVar%> for the HTML values.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
what is a "java.lang.System Property"   ? 20 57
nextBoolean(double p) for Random class 3 35
map related example 6 38
Oracle SQL syntax check  without executing 6 38
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now