select one item name throug combo box than other combobox show item price

select one item name throug combo box than other combobox show item price

i have one table in database item master..if i select one item name through combo box than other combobox show item price only select item name... how i can implement through jsp in a single jsp page.

View Answers

April 3, 2012 at 1:11 PM

We have used table item having fields itemId, itemName, itemPrice.

1)items.jsp:

<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<html>
<head>
<script language="javascript" type="text/javascript">
var xmlHttp;
function showState(str){
if (typeof XMLHttpRequest != "undefined"){
xmlHttp= new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlHttp==null){
alert ("Browser does not support XMLHTTP Request")
return
}
var url= "price.jsp";
url += "?count=" +str;
xmlHttp.onreadystatechange = stateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function stateChange(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("item").innerHTML=xmlHttp.responseText
}
}
</script>
</head>
<body>
<select name='country' onchange="showState(this.value)">
<option value="none">Select</option>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root";);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from item");
while(rs.next()){
%>
<option value="<%=rs.getString("itemName")%>"><%=rs.getString("itemName")%></option>
<%
}
%>
</select>
<br>
<div id='item'>
<select name='item' >
<option value='-1'></option>
</select>
</div>
</body>
</html>

2)price.jsp:

<%@page language="java" import ="java.sql.*" %>
<%
String itemname=request.getParameter("count");
String buffer="<select name='state'><option value='-1'>Select</option>";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root";);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from item where itemName='"+itemname+"' ");
while(rs.next()){
buffer=buffer+"<option value='"+rs.getString("itemPrice")+"'>"+rs.getString("itemPrice")+"</option>";
}
buffer=buffer+"</select>";
response.getWriter().println(buffer);
%>

August 23, 2012 at 3:58 PM

its help ful to my code thank you very much









Related Tutorials/Questions & Answers:
select one item name throug combo box than other combobox show item price
select one item name throug combo box than other combobox show item price  i have one table in database item master..if i select one item name through combo box than other combobox show item price only select item name... how i
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using QTP
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using... Flex controls. But i am not able to select any item from Spark Combo Box. I tied using .Open (Its not opening the drop down list) , also i tried using Select
Advertisements
how to insert the selected item of combobox in mysql - XML
how to insert the selected item of combobox in mysql  hi, i have to insert the selected item from combobox into MYSQL database.pls provide... of combobox in mxml.how to insert selecteditem in database. pls suggest me i have
pbml in inserting selected item from combobox into mysql - XML
pbml in inserting selected item from combobox into mysql  hi, i have to insert the selected item from combobox into MYSQL database.pls provide... of combobox in mxml.how to insert selecteditem in database. pls suggest me i have
item lookup
item lookup  I need to create a lookup box in a grid that searches and filters at the same time. Upon selection the item with its price should be displayed. The control would then position below the first selection, so
nested selected tag ihave display selected item
nested selected tag ihave display selected item   i have two combo boxes combo1 combo1 in first combo box i taken as follows select name="combo1...="2">UK etc in other combo box display all states relate first combo box
navigation between panels when item is selected from jcombobox - Swing AWT
(2nd panel).the combo box is in main panel. when a item is selected from combobox the 2nd panel should navigate to other panel. for now i have 4 item in the combo...navigation between panels when item is selected from jcombobox  hi
how to select second combobox value .
how to select second combobox value .  I requirement is , i have two combo box, i am selected first combo box value then automatically second combo box value show ,But this both combo box value i retrieves in database. please
remove item from list box using java script - Java Beginners
remove item from list box using java script  remove item from list box using java script  Hi friend, Code to remove list box item using...); } function addItems(selectbox){ addItem(document.list.item, "One","One"); addItem
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
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
How can i select a particular item in jpopup menu through java programs
How can i select a particular item in jpopup menu through java programs ... menu item in it. assume that the user pressing down key 3 times. I need to show... a perticular menu item in jpopup menu to be selected. I created a gui where it has
Item Events in Java
taken. Items of the combo box are as follows : Red, Green, Blue. If you select an item from the combo box then the message with the item name will be displayed... events in java. This demonstrates that the event generated when you select an item
How to create Combo Box in SWT
is called. If you select the cold drink from the first combo box, the array of drinks... select Tea or Coffee, the second combo box shows the text 'not Applicable'.ADS... select the tea, it will show you Not Applicable on the second combo box.ADS
Use of Select Box to show the data from database
_TO_REPLACE_6 When we select any other item from select box then it will reflect... Use of Select Box to show the data from database       Example program using Select Box to show retrieved data
How to change object item to integer item
How to change object item to integer item  How to change objectitem to integer item?thankyou
How to obtain the selected data item from a list box when listbox contains objects wrapped under Arraylist?
want to copy the selected item(one at a time) from the list box to the text box. I...How to obtain the selected data item from a list box when listbox contains objects wrapped under Arraylist?  I have a jsp page containing a list box
return item in jquery
return item in jquery  How to return items/variables in JQuery?   See the code below to find out how to return an Item in Jquery: function findItem() { var item; while(if_item_not_found) { // search
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
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...: Select a country:  <---Select---> Thanks
delete an item from database
delete an item from database  how to delete an item from the database using jsp
ModuleNotFoundError: No module named 'item'
ModuleNotFoundError: No module named 'item'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'item' How to remove the ModuleNotFoundError: No module named 'item' error
Item renderer in flex
Item renderer in flex  Hi...... please tell me about How to create item renderers in flex? give an example for that Thanks
navigation item back button
navigation item back button  I wants to add a navigationBar on the top of my UIWebView also a navigation item "back button". can anyone please explain how the back and refresh button works
Item renderer in flex
Item renderer in flex  Hi..... How does item renderer work? How do I add item renderer at runtime? Please me the right answer so i cam implement this in my apps. Thanks  Ans: The base class for Spark item
Item renderer in flex
Item renderer in flex  Hi... Please tell me about what does listData contain in ItemRenderers? What is the Type of listData? please give an example for that........ Thanks
Item renderer in flex
Item renderer in flex  Hi..... I have a problem How do you call a method in particular ItemRenderer. Also the ItemRenderer is your own Custom Component? please give me an example for that...... Thanks
Java JComboBox Get Selected Item Value
you will select any of the list item it will show in the combo box... example into which I shall get the combo box selected item value and stored... will open for providing the Data Source Name, give the DSN name and click on Select
To get the value of more than one text box in an HTML page to a jsp page - JSP-Interview Questions
To get the value of more than one text box in an HTML page to a jsp page  An html file has a text box as To get the value of this text box in a JSP.... With regards   All controls(Text box, combo box....) in an html file
populating one dropdown box depending on the value of other using jsp
populating one dropdown box depending on the value of other using jsp  HI i have scenario i need to populating one dropdown box depending... in dropdown box one after the other CREATE TABLE CITY_MASTER( CITYID BIGINT
highlight menu item html
highlight menu item html  highlight menu item in html or CSS   <body id="index"> <div id="menu"> <ul> <li class="index" ><a href="index.html">Index page</a></li> <
Combo Box operation in Java Swing
if the combo box has one item at least otherwise a message box will display... of the JComboBox class which returns the name of the item of the combo box at the specified position. This specification of position the item in the combo box is held
Linking JMenu Item with a JPane in Netbeans
Linking JMenu Item with a JPane in Netbeans  How do you link a Jpane window to a JMenu Item in Java Netbeans
Helps with combo box and frame
Helps with combo box and frame  Hi i have a combobox and when i click on add button another frame pop up with text field(name ,address etc... on the second window and click confirm i would have the information on the combo box. i
Combo box In Java
an item from the item list. You can never select more than one item from a combo.... Combo box allow you to select one of the option which appear at the user... item from the existing combo box mode. JComboBox(Object[]  ob) : Create
Java Swing dynamic Combobox
_TO_REPLACE_1 On selecting the item from one combobox, related data will get displayed... the data in one combobox related to another combobox. For this, we have created two combo boxes. In the first combobox, we have added four items. When the user
doubt in combobox in flex - XML
access to combo box item name as string. As per your query i coded an example... a combobox with 10 items when i select the particular item i has 2 display...doubt in combobox in flex  hi, i have doudt in combobox
Adding checkbox to List as item
Adding checkbox to List as item   can we add checkox to List   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt....()); CheckListItem item = (CheckListItem) list.getModel().getElementAt
Flex ComboBox controls
collection which is display the month name in combo box. And you can see the property... of event, that show how to access the value of combo box in flex. Output... //Alert.show("Combo Box is "+event.type); } private function
ModuleNotFoundError: No module named 'item-tracking'
ModuleNotFoundError: No module named 'item-tracking'  Hi, My... 'item-tracking' How to remove the ModuleNotFoundError: No module named 'item-tracking' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Output_item'
ModuleNotFoundError: No module named 'Output_item'  Hi, My Python... 'Output_item' How to remove the ModuleNotFoundError: No module named 'Output_item' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'print-item'
ModuleNotFoundError: No module named 'print-item'  Hi, My Python... 'print-item' How to remove the ModuleNotFoundError: No module named 'print-item' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'item-tracking'
ModuleNotFoundError: No module named 'item-tracking'  Hi, My... 'item-tracking' How to remove the ModuleNotFoundError: No module named 'item-tracking' error? Thanks   Hi, In your python
combo box
combo box  Hi, [_|] dropdown box... a screen like this using jsp-servlet(or DAO,DTO),in that drop down box i should get... to that user in left list.when we select module from left list and click INCLUDE button
Get specific item details by clicking on hyperlink
button, if I click on that button it lists all items with item name... on the image or item name I should get total datails from the database...;%=rs.getString("item")%>"></td></tr> <tr><td>Price
Problem to display checkbox item
; Statement st=null; st=conn.createStatement(); rs = st.executeQuery("select...;td> <input type="checkbox" name="check" value=<...=xmlHttp.responseText; } } </script> </head> <form name="form

Ads