Home Answers Viewqa JSP-Servlet select one item name throug combo box than other combobox show item price

 
 


Alpesh patel
select one item name throug combo box than other combobox show item price
2 Answer(s)      a year and a month ago
Posted in : JSP-Servlet

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 Pages:
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
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
jsp combobox
..if i select one country throug combo box than other combobox show state only select country ...than city how i can implement through jsp   1...; <br> <div id='state'> <select name='state
combobox
combobox  Hi, i have one combo Box with 5 options and one Other option also there,when i select a other i need to get a new text box for entering user option and when click on submit it should save on same field in database
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
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... is added for the item tea and coffee, therefore if you select the tea, it will show you
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
Java JComboBox Get Selected Item Value
example into which I shall get the combo box selected item value and stored... will be displayed as follows : 3. When you will select any of the list item it will show... Source Name, give the DSN name and click on Select button When you will click
Item Events in Java
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 in the text area... events in java. This demonstrates that the event generated when you select an item
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
Problem to display checkbox item
; Statement st=null; st=conn.createStatement(); rs = st.executeQuery("select...;td> <input type="checkbox" name="check" value=<...; </head> <form name="form"> <table border="1"> <tr><
combobox
in combo box ,the related employee name will be displayed in text field... i already stored combo box values from database. can u pls tell me the proceduer to get... = xmlHttp.responseText; document.getElementById("name").value= showdata
Flex ComboBox controls
closeCombo(event:DropdownEvent):void{ //Alert. show("Combo Box is "... array collection which is display the month name in combo box. And you can see... is any type of event, that show how to access the value of combo box in flex
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
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
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
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
Use of Select Box to show the data from database
select any other item from select box then it will reflect to the text box as well... Use of Select Box to show the data from database       Example program using Select Box to show retrieved data
Java Swing dynamic Combobox
: On selecting the item from one combobox, related data will get displayed in another one... 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
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
Combo Box operation in Java Swing
if the combo box has one item at least otherwise a message box will display... of the item of the combo box at the specified position. This specification of position the item in the combo box is held by the getItemAt() method
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:<
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(regno,sname,sgen). Now i want to select one "regno" from Combobox and then after
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...; </head> <body> <select name='country
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...;/script> </head> <body> <select name='country
combobox
; <select name="count" class="Textbox" onChange="ChangeURL1('userentry...="77%" height="25"><b> <select name="sta" class="Textbox" onChange... ...when i selected country ten only state show of that country similarly city
combobox
; <select name="count" class="Textbox" onChange="ChangeURL1('userentry...="77%" height="25"><b> <select name="sta" class="Textbox" onChange... ...when i selected country ten only state show of that country similarly city
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
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
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
ComboBox ItemRenderer in DataGrid
ComboBox ItemRenderer in DataGrid  Hi..... How can I create custom combo box itemtenderer in the flex datagrid? please give me an example... ArrayCollection([ {Name:"Bikrant", City:"Delhi
two linked combobox
two linked combobox  give jsp example of two combo box when i select state in one combobox in second combo box cities will display according to state which i select
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
Chart Item Event in Flex4
you will show the value of item when you click on the data item. If you click...Chart Item Event in Flex4: Chart uses the ChartItemEvent when you perform the operation click on the chart Item. This event is the part of chart package
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
combo box code problem
combo box code problem  in this my problem related to : when i...;</td> <select name="combo2" > </select> <td...;select name="ddlstCity" id="ddlstCity" class="txtBox" width="119px"> <
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
Combobox application - Swing AWT
document.getElementById("name") write inside select onchange=Get(this); Thanks...Combobox application  hi, i am facing a problem in updation of the comboboxes i m using in an application...for the first time the selectec item does
JavaScript Dynamic Combo Box
JavaScript Dynamic Combo Box Here we are going to create dynamic combo box... in respective arrays. As the user selects a country from the first combo box, the cities...; method="post"><select name="combo1"
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
how to calculate the price on the option box
how to calculate the price on the option box  How i calculate the value when i using a option box with 2 option..first option i used for product name and for the second i used for the quantity..which function should i used
Combobox Tag (Form Tag) Example
; In this section, we are going to describe the combobox tag. The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box functionality. You can place text in the INPUT control by using the 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
combobox updation - Java Beginners
a vector, and then on clicking on a specific combobox item, the 2nd and 3rd comboboxes are populated with another vector. then on clicking the 3rd combobox item... in a different panel. the problem is on clicking of 2nd combobox-i am not getting the item
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
Navigation with Combo box and Java Script
;/select> </td>  <td><select name="item"> <... Navigation with Combo box and Java Script  ... in Navigation with Combo box?  JavaScript is a 2-level combo box menu script
How to store JComboBox selected Item into Ms Access Database - Java Beginners
=stmt.executeQuery("select name from course"); jc.addItem("Select"); while(rs.next...How to store JComboBox selected Item into Ms Access Database  How to store JComboBox selected Item into Ms Access Database.  Hi Friend
How to save JCombobox Selected Item in to Access Database - Java Beginners
=stmt.executeQuery("select name from course"); jc.addItem("Select"); while(rs.next...How to save JCombobox Selected Item in to Access Database  How to save JCombobox Selected Item in to Access Database  Hi Friend, Try
combox
combox   i have one table in database item master..if i select one item throug combo box than other combobox show item price only select item name...; </select> <br> <div id='item'> <select name='item' > <
Flex combobox selecteditem
value of the item, that means, name of the item is returned with which the item is included in the combo box item list.  Syntax for using the property... the flex combo box control. Below example contains a flex combo box control with id

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.