Home Answers Viewqa JSP-Servlet How to retreive data by using combo box value

 
 


Raja
How to retreive data by using combo box value
1 Answer(s)      3 years and 3 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...
View Answers

February 25, 2010 at 11:26 AM


Hi Friend,

We are providing you a single jsp page 'combo.jsp'.This page performs action on itself.

<%@ page language="java" %>
<%@ page import="java.sql.*" %>

<%!
Connection conn = null;
ResultSet rs =null;
Statement st=null;
String query="";
int cid;
%>
<%
if(request.getParameter("cid")!=null){
cid=Integer.parseInt(request.getParameter("cid"));
}else {
cid=0;
}
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
st = conn.createStatement();
rs = st.executeQuery("select * from student");
%>
<html>
<head>
<script type="text/javascript">

function view(){
var cid=document.getElementById("student").selectedIndex;
window.location.replace("http://localhost:8080/examples/jsp/combo.jsp?cid="+cid);
}
</script>
</head>
<body>
<select id="student" onchange="view(this)">
<option value="0">--Please Select--</option>
<% while(rs.next()){ %>
<option value='<%=rs.getInt("id")%>'><%=rs.getInt("id")%></option>
<%}%>
</select>
<%
rs = st.executeQuery("select * from student where id='"+cid+"'");
%>
<%
String name="";
while(rs.next()){
name=rs.getString("name");
}%>
<input type="text" value="<%=name%>">
</body>
</html>

Thanks









Related Pages:
How to retreive data by using combo box value - JSP-Servlet
How to retreive data by using combo box value  Hello friend... with html .. So i cannot use request.getParameter. If i am using null value... I can print combo box values
How to retreive data by using combo box value - JSP-Servlet
How to retreive data by using combo box value  I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all.... Note: I am using only this jsp form.. i do not use to get values from
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example, In Employee.jsp form, When i click employee id value in combo box...... i already stored combo box values from database. pl
How to retrieve data by using combo box value in jsp? - JSP-Servlet
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.... Note: I am using only this jsp form.. i do not use
How to retrieve data using combo box value in jsp? - JSP-Servlet
How to retrieve data using combo box value in jsp?  Hi freind, I already post this question. I need urgent help from u. pl response me.... All actions in the same page.......  Hi Friend, Please visit
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  Hi Friends... in combo box from database.. by using select*from studentinformation; But when i... related value.... I am using only this page.. not get value from another page
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... combo box which will then load the next combo box values, now i know how... to the client using ajax, and then populate the combo box, I must'nt reload
How retreive data from database without using post method in jsp - JSP-Servlet
How retreive data from database without using post method in jsp  Tell me how?  Hi Friend, If you don't want to use post method then use... the selected value from the combo box and get textbox value from another page
Acees data from database using combo box - JSP-Servlet
Acees data from database using combo box  please let me how i access the data from database when i select combo box combo2 having values Arts... value 11 or 12, otherwise combo box combo2 remain hide. Here is JSP's files
How to retrieve data from database by using combo box value in jsp? - JSP-Servlet
How to retrieve data from database by using combo box value in jsp?  ...; } function showEmp(emp_value) { if(document.getElementById("emp_id").value...="+emp_value xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url
combo box value
combo box value   i want to populate one combo box value based on another combo box value using ajax   1)country.jsp: <%@page import...' onchange="showState(this.value)"> <option value="none">
combo box value
combo box value   i want to populate one combo box value based on another combo box value using ajax   1)country.jsp: <%@page...' onchange="showState(this.value)"> <option value="none">
how i conditional access the data from database using combo box. - JSP-Servlet
how i conditional access the data from database using combo box.   i have combox box named class when i select its value 11 or 12, another combo box appears named Subject values Arts, Commerce, Science. how i conditional
How to create Combo Box in SWT
How to create Combo Box in SWT       This section illustrates you how to create a combo box... are added to the  first combo box by using the method add() of Combo class. 
populate Combo Box dynamically
populate Combo Box dynamically  Hi, How to populate the Combo Box dynamically using Flex with Jsp's
Dynamic loading of Combo box list using servlet - JSP-Servlet
Dynamic loading of Combo box list using servlet  I have the category... I give theortical descrption read it! Select a value from drop dwon box, retrive it in a servlet, By using this value communicate to the data base
how to get combo box value - JSP-Servlet
how to get combo box value  i have created 1 servlet & 1 jsp page... in combo box in jsp page: (small part of my code) "> now i want... to store that id in database. how to get that value???   Hi Friend
Combo Box operation in Java Swing
the Combo Box component, you will learn how to add items to the combo box... holds the integer value for the position number of he of the item in combo box... Combo Box operation in Java Swing   
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking the value of combo box . I am not getting it plz help me out .   hi
How to pass the value of Selected Value of combo box into sql ??
How to pass the value of Selected Value of combo box into sql ??  My SQL Database Name is MHS, user=root, password=admin,table name is sub_comb... submit i want to display other field. how to get it?? plz help me
combo box - JSP-Servlet
combo box  I am using a JSP form in which a combobox is given and I want to populate data in it from database and on the basis of yhe selected item I want to display related data in a textbox  Hi Friend, Create
how to create a combo box in html
how to create a combo box in html  <tr> <td>Number<span class=mandatory>*</span></td> <td> <select name="number" id="course" style="width:158px;"> <option value="none">----Select
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one combo box is there and another filed is version of the server(like 1.0,2.0) like
Loading combo box from oracle
Loading combo box from oracle  how can i load values into a combobox from oracle database when a value is selected in another combo box
how can retrive value from combo box in servlet?
how can retrive value from combo box in servlet?  i have a jsp page with combobox. And i want to get value from combox to servlet
JavaScript Combo Box Validation
JavaScript Combo Box Validation       This application illustrates how to validate the combo box using JavaScript validation. In this example we create a combo box of different
Store combo box value - Development process
Store combo box value  Hi , this is my code. Here wen i click submit button combo values are stored like 1,2,3... but i want to store value . plz send me code. while validating a form, i have entered data in first field
Dojo Combo Box
Dojo Combo Box          In this section, you will learn what is combo box and how to create a combo box in dojo. For creating the Combo box  you need "
combo box
combo box  Hi, [_|] dropdown box [ ] [INCLUDE... a screen like this using jsp-servlet(or DAO,DTO),in that drop down box i should get
Combo box value Error - WebSevices
Combo box value Error   if($_SERVER['REQUEST_METHOD'] == 'POST...']); } document.frmProposal.hdVisa.value = document.getElementById('cmbVisa').value; Error: The "cmbVisa" Value is Null,This error will displayed for these coding.So tell me
how to retreive data dynamically from mysql to drop down list
how to retreive data dynamically from mysql to drop down list   sir... fron end using jsp , after storing the data successfully .i want to retrieve the data of a particular column in a table into drop down list dynamically
combo box - JSP-Servlet
combo box  how to get a combo box in jsp page which allows editing as well as list box
Combo Box Using Ajax In JSP
to Select the Data from database using Ajax in combo box. We created two file... Combo Box Using Ajax In JSP   ...; run on browser then it will  having a Select Box Employee Id.On select emp
How to create textbox on combo value selection using javacsript in jsp?
How to create textbox on combo value selection using javacsript in jsp?  dynamically create textbox on combo value selection. when select multiple values then create multiple textboxes
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered... for the value in text box and if found it should retrieve the corresponding... a dynamic web application. Am using eclipse IDE and Apache tomcat server. i need
Code to store sub combo box value - Development process
Code to store sub combo box value  Hi Deepak, In the following code i want to store subcombo box value instead of number. Already "Dkn/Tmz...,advertisement ( numbers are stored like 1 2 3 ) Add Data var arr = new Array
date in combo box
date in combo box  strong texthello, how can i desplay the current year and next year in combo box???!!! it must be uppdate atumaticaly every year>>>
base the value of first combo box, how i display the second combox - JSP-Servlet
base the value of first combo box, how i display the second combox    i have a combo box for classes. my requirement is when i select the class, if class is 11 or 12 the second combo box of subject should be appear. please
How to get data from DB in to Text box by using Jsp & Ajax
How to get data from DB in to Text box by using Jsp & Ajax   I want to get the data from database in to text box in a jsp page by using Ajax. If I... with a and from that i need to select the required value and i should store
java combo box
java combo box  how to display messagedialogbox when the combobox is null, Thanks in advance
Flex ComboBox controls
is any type of event, that show how to access the value of combo box in flex. Output of this example is,Output:- Combo box provide scroll Bar if the value... to access the value of Combo Box.  For Example:- <?xml version="1.0
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox  ... value of combo box should be sent. but when i clicked to submit button, it do...); } function hide(){ if (document.getElementById) { document.getElementById('combo
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox    thanks for your reply. i want to know suppose the second combo box appear only when i select the class 11th or 12th. please review. your answer
loading value into combo box by selecting value from other combo box - JSP-Servlet
loading value into combo box by selecting value from other combo box  ... is that as i select state from state_combo_box,then the next combo box is dynamically... box with constituency corresponding to district..... all three combo box
jtable combo - Java Beginners
jtable combo  i am using jtable (using defaulttablemodel) ,when i am click on a particular cell of jtable i want to display the combo box...()); String data[][] = {{"",""},{"",""},{"",""},{"",""}}; String col
retreive integer data from database
retreive integer data from database  i made a table named result having two fields 1>rollno 2>marks i creates a gui where i use a textfield... the following code but the error appears is "no specific value for parameter 1" so
combo box connection
combo box connection  how to provide connection between three combo boxes,if my 1st combo box is course and 2nd combo box is semester and 3rd combo box is my subjects.what's the coding to provide the connection between this three
How to get the values from the Combo Box - JSP-Servlet
How to get the values from the Combo Box   Sir, Actually i am getting the values in the combo box from table.I want what ever the value i select in combo box its corresponding records will display
How to show autocomplete textbox values on combo box option selection using database?
How to show autocomplete textbox values on combo box option selection using database?  When I select option(i.e First Year) then it will show list of student names in auto-complete text box
Helps with combo box and frame
Helps with combo box and frame  Hi i have a combobox and when i click... on the second window and click confirm i would have the information on the combo box. i don't really know how to doing it.   Sorry i forget to put my code i

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.