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



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

Have Programming Question? Ask it here!
 
 
 


Alpesh patel
select one item name throug combo box than other combobox show item price
2 Answer(s)      2 years 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.


Advertisement
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
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
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
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
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
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
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 change object item to integer item
How to change object item to integer item  How to change objectitem to integer item?thankyou
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
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 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
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
delete an item from database
delete an item from database  how to delete an item from the database using jsp
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
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
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
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
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..... 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
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
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> <
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
Adding checkbox to List as item
Adding checkbox to List as item   can we add checkox to List   Hi Friend, Try the following code: import java.awt.*; import javax.swing.... index = list.locationToIndex(event.getPoint()); CheckListItem item
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
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
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
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><
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
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
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
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
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
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
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 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
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.*; public class ChoiceListDemo{ public static void main(String[] args) { Frame
How to store JComboBox item into database
); jLabel3.setText("Item Name"); getContentPane().add(jLabel3,new AbsoluteConstraints(27...How to store JComboBox item into database   import...(javax.swing.SwingConstants.CENTER); jLabel2.setText("Item Code"); getContentPane().add(jLabel2,new
java combo box
java combo box  how to display messagedialogbox when the combobox is null, Thanks in advance
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
combo box - JSP-Servlet
combo box  how to get a combo box in jsp page which allows editing as well as list box
populate Combo Box dynamically
populate Combo Box dynamically  Hi, How to populate the Combo Box dynamically using Flex with Jsp's
Advertisements
 

 

 

DMCA.com