This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Problem with using multiple queries in single jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with using multiple queries in single jsp page" Watch "Problem with using multiple queries in single jsp page" New topic
Author

Problem with using multiple queries in single jsp page

sravya perumahanti
Greenhorn

Joined: Jun 06, 2010
Posts: 1

Thanks for your reply sir.
this is my code-

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<body>
<center>
<form>
<table border="0">
<tr> <td> bulbtype </td>
<td> <input type="text" name="bulbtype"></td> </tr>
<tr> <td> bulbwatts </td>
<td> <input type="text" name="bulbwatts">
<input type="submit"/></td>
</tr>

<%
String bulbtype=request.getParameter("bulbtype");

String bulbname=request.getParameter("bulbname");
Class.forName("oracle.jdbc.OracleDriver").newInstance();
String connectionURL = "jdbcracle:thin:@127.0.0.1:1521:XE";
Connection conn = DriverManager.getConnection(connectionURL,"system","sravya");

Statement stmt=conn.createStatement();
Statement st=conn.createStatement();
ResultSet rs1 = stmt.executeQuery("select * from bulb where type="+bulbtype);
ResultSet rs2 = st.executeQuery("select * from bulb where watts="+bulbwatts);
%>
<%while(rs1.next()){%>
<tr> <td>name1</td>
<td> <input type="text" value="<%=rs1.getString("name")%>"></td> </tr>
<%}%>

<%while(rs2.next()){%>
<tr> <td>name2</td>
<td> <input type="text" value="<%=rs2.getString("name")%>"></td> </tr>

<%}%>

</table>
</form>
</center>
</body>
</html>


Im getting this error:

An error occurred at line: 24 in the jsp file: /bulb1.jsp
bulbwatts cannot be resolved
21: Statement stmt=conn.createStatement();
22: Statement st=conn.createStatement();
23: ResultSet rs1 = stmt.executeQuery("select * from bulb where type="+bulbtype);
24: ResultSet rs2 = st.executeQuery("select * from bulb where watts="+bulbwatts);
25: %>
26: <%while(rs1.next()){%>
27: <tr> <td>name1</td>


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please TellTheDetails--we have no idea what code you're using, what error you're getting, etc. ItDoesntWorkIsUseless.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with using multiple queries in single jsp page
 
Similar Threads
cookies problem
two dropdown menus
Sending Email from jsp page
I M NOT ABLE TO DEFINE VARIABLES IN JSP.
inserting data to a table