How to retrieve data by using combo box value in jsp?
I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all are satisfaction in this form.. What will i do. My code is following there...
<select select name="productid">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:Airworld");
query=con.prepareStatement("select * from Productdetails where productid='?'");
rs=query.executeQuery();
while(rs.next())
{
pid=rs.getString(1);
%>
<option><% out.println(pid); %></option> /// Here stored Combobox values from database.
<%
System.out.println("Product Id=" +pid);
}
rs.close();
query.close();
%>
</select>
</td>
<%
productid=pid;
query=con.prepareStatement("select * from Productdetails where productid="+"'"+productid+"'");
rs=query.executeQuery();
while(rs.next())
{
pname =rs.getString(2); // Here i am not store product name into text box.
}
%>
<td width="541"><input type="text" width="525" name="productname" value="<% out.println(pname);%>" /></td>
Note: I am using only this jsp form.. i do not use to get values from another form...
View Answers
Related Tutorials/Questions & Answers:
Advertisements