Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet How to retrieve data by using combo box value in jsp?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Raja
How to retrieve data by using combo box value in jsp?
0 Answer(s)      4 years and 8 months ago
Posted in : JSP-Servlet


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...

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com