Note that there are some explanatory texts on larger screens.

plurals
  1. POto retrieve data from database and show it with tha radio buttons with radio botton containing the data value
    primarykey
    data
    text
    <p>i am building a web based railway ticket reservation system. I want to retrieve all the required data from the database using while loop but show one of the data i.e train_no with radio button so that i could pass it to the next jsp. but while doing this i am getting an sql exception "data not found" . please help me. following is a part of the code...</p> <pre><code> &lt;%@page import="java.sql.*"%&gt; &lt;%@page import="javax.servlet.*"%&gt; &lt;%@page import="java.io.*"%&gt; &lt;%String s3=String.valueOf(request.getAttribute("s2")); String d3=String.valueOf(request.getAttribute("d2")); String dj3=String.valueOf(request.getAttribute("dj2")); %&gt; &lt;% Connection con; PreparedStatement ps,ps1; ResultSet rs; try{ String driverName="sun.jdbc.odbc.JdbcOdbcDriver"; String url="jdbc:odbc:rail"; String username="root"; String password="root"; Class.forName(driverName); con=DriverManager.getConnection(url,username,password); ps=con.prepareStatement("Select * from train_for where source=? and destination=? and doj=?"); ps.setString(1,s3); ps.setString(2,d3); ps.setString(3,dj3); rs=ps.executeQuery(); while(rs.next()) { %&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="radio" value="&lt;%=rs.getString("train_no")%&gt;" name="rad1"&gt;&lt;%=rs.getString("train_no")%&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;%=rs.getString(4)%&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;%=rs.getString(5)%&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br&gt;&lt;br&gt; &lt;%} } catch(Exception e) { out.println(e); } %&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload