checkbox with dropdown listbox in jsp

i loaded the the data into the drop down listbox in jsp from access database.now i have to add a check box,if it checked means dropdownlist box carryout the data's,else it should be empty.plz help me..plz sends the code for that in jsp.its very very urgent one....

View Answers

April 7, 2011 at 1:56 PM

1)select.jsp:

<%@page import ="java.sql.*" %>
<html>
     <head>
     <script type="text/javascript">
     function showData(){ 
    if (document.form.check.checked==true){

xmlHttp=GetXmlHttpObject()
var url="select2.jsp";
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
}
function stateChanged(){ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
     document.getElementById("name").innerHTML=xmlHttp.responseText;   

    } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
  xmlHttp=new XMLHttpRequest();
 }
catch (e){
 try  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
   </head>
   <body>
   <form name="form">
   <br><br>

      <input type="checkbox" id="check"  onclick="showData();">

   <div id='name'>
<b>Select Data</b>  
<select name='name' >
<option value='-1'></option>
</select>
</div> 
   </form>    
   </body>
   </html>

2)select2.jsp:

<%@page import="java.sql.*"%>
<%
 String buffer="<select name='name' ><option value='-1'>Select</option>";  
 try{
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student","","");
 Statement stmt = con.createStatement();  
 ResultSet rs = stmt.executeQuery("Select * from data");  
   while(rs.next()){
       String name=rs.getString("name");

   buffer=buffer+"<option value='"+name+"'>"+name+"</option>";  
   }  
 buffer=buffer+"</select>";  
 response.getWriter().println(buffer);
 System.out.println(buffer);
 }
 catch(Exception e){
System.out.println(e);
 }

 %>









Related Tutorials/Questions & Answers:
checkbox with dropdown listbox in jsp
checkbox with dropdown listbox in jsp  i loaded the the data into the drop down listbox in jsp from access database.now i have to add a check box,if it checked means dropdownlist box carryout the data's,else it should
Display JSP selected listbox and checkbox in xml-please help me
Display JSP selected listbox and checkbox in xml-please help me  Hi, I have three Listbox on my jsp page. I want to do following:ADS_TO_REPLACE_1... jsp. When user select something from 2nd list, third page contains checkbox
Advertisements
jsp listbox - Java Beginners
jsp listbox  thanks for your earlier post. I have one list box filled from the datebase. i want my second listbox to be filled from the database based on the selection of first list box. without refreshing my jsp page
Dropdown Checkbox list
Dropdown Checkbox list This tutorial explains how to create jquery Dropdown Checkbox list in JSP.  This example is created in eclipse IDE and run... jquery Dropdown Checkbox list. The application directory structure should look like
JSP CheckBox
JSP CheckBox          JSP CheckBox is used to create a CheckBox in JSP..._TO_REPLACE_1 The Tutorial illustrate an elaborate example from 'JSP CheckBox
jsp dropdown - JSP-Servlet
jsp dropdown  in my table there are 3 fields named orderid ,itemname, itemqty. i want code that fetch orderid in dropdown... on select dropdown get all items list of that orderid... there are multiple items at one orderid
jsp dropdown - JSP-Servlet
jsp dropdown  print dropdown selected value in same page without refreshing page in jsp....   Hi Friend, Try the following code: 1)selectbox.jsp: var xmlHttp function showState(str
dropdown list in jsp
dropdown list in jsp  hai, i have static dropdown list.. i want to get the selected value in string variable without jsp regards asha
Create Listbox in JSP using AJAX control
Create Listbox in JSP using AJAX control  Hi everyone!!! I want to create an application for internal portal. here i have to create one dropdown listbox to select single elemnt using AJAX control . But i don't know anything
JSP Checkbox
JSP Checkbox In this tutorial you will learn how to create a checkbox using JSP. As we know, checkbox allows multiple selection at a time, but radio... to create a checkbox in JSP. Now here is the example below: Example : An example
jsp dropdown refresh - JSP-Servlet
jsp dropdown refresh  Sir Thank u for your jsp code for dependent dropdown list, i used it in different table for data extraction but the probleam during data extraction when i select first drop down its refresh then 2nd
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
creating dropdown lists in jsp
creating dropdown lists in jsp  i want to create two dropdown list which are dependent that is the first box choice have to evaluate the second boxs options
dropdown - JSP-Servlet
dropdown  i have below code for dropdown . now i want to user that textbox value in query at same page... how to get it in a new variable??? function getValue(){ var combo = document.getElementById("sel"); var val
dropdown - JSP-Servlet
dropdown  i want to use dropdown select value in query-string in same page.. Using selected 'name' want to fetch details of that person from database.. without using Ajax...  Hi Friend, Try the following code
checkbox selection in jsp
checkbox selection in jsp  hey guys i am working on a web based project using jsp. In my project i am having 9 check boxes in 3 rows in the same form. I want to select i check box from each row and also i want to avoid many
DropDown in ajax+jsp
DropDown in ajax+jsp  I have four dropdown if i select first dd then only corresponding values must be there in 2nd dd,same with 3 and 4... dropdown. You can create the fourth one similarly. For the above code, we have
dropdown - JSP-Servlet
dropdown  i want to use dropdown select value in query-string in same page.. Using selected 'name' want to fetch details of that person from database..  Hi Friend, Try the following code: 1)ajaxExample.jsp
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
3 dropdown list from the database using JSP
3 dropdown list from the database using JSP  Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
jsp- database dependent dropdown list
jsp- database dependent dropdown list   i want 2 dropdown list 1... suppose class a the corresponding section dropdown list should retrieve the section respective to that class from database. please help by providing the code in jsp
Learn about JSP CheckBox
Learn JSP CheckBox The tutorial highlight the features by whihc you will be able to know what is JSP checkbox and also how it works in creating a checkbox... as from 'JSP CheckBox'. To understand and grasp the example we create
JavaScript Checkbox In DropDown box
JavaScript Checkbox In DropDown box In this section, you will learn how to display the checkboxes inside the dropdown box. Now to implement this, we have... the selected values, select the checkbox (or checkboxes) and click the button
checkbox
checkbox  how to insert multiple values in database by using checkbox in jsp
jsp -sevlet connecting to database using dropdown
jsp -sevlet connecting to database using dropdown  How can I get my dropdown list from oracle database and then submit it to another table in JSP. I... it to the JSP to populate the options and when an option is submitted, it send
Inserting values into a database table of selected DropDown in jsp.
Inserting values into a database table of selected DropDown in jsp.  http://www.roseindia.net/answers/viewqa/Ajax/15250-DropDown-in-ajax+jsp.html Thank you for this program, it helped me alot to learn. I have done it. now i want
Populate dropdown menu from database using jsp and servlet
Populate dropdown menu from database using jsp and servlet  please i need code to populate dropdown menu from mysql database using jsp and servlet. thanks
deleting messages using checkbox in JSP
deleting messages using checkbox in JSP  Am working on a Mail Server Project. In that I have Inbox And Outbox Messages. Now Each and Every message...;input type="checkbox" name="inboxchk" value="<%=rs.getInt("omailid")%>"><
deleting messages using checkbox in JSP
deleting messages using checkbox in JSP  Am working on a Mail Server Project. In that I have Inbox And Outbox Messages. Now Each and Every message...;input type="checkbox" name="inboxchk" value="<%=rs.getInt("omailid")%>">
DropDown and text boxes with AJAX, JSP - Ajax
DropDown and text boxes with AJAX, JSP  Hi, we are using one drop... present. we are already using jsp's and java technology. can we integrate ajax in jsp's to achieve the same? if so could you please guide me to achive the same
how to insert checkbox value into database using jsp
how to insert checkbox value into database using jsp  how to insert check box value to the database using jsp my code is <link href...; <td align="center"> <input type="checkbox
dropdown
dropdown  how to hide textbox field when i deselect from select dropdown
how to retrieve the id value itself from the access database to drop down listbox in jsp
how to retrieve the id value itself from the access database to drop down listbox in jsp  how to retrieves the id which is an int datatype, from access database to drop down list box in jsp...plz send the code for that.....plz
how to insert checkbox value into database using jsp
how to insert checkbox value into database using jsp  How to insert check box value to the oracle database using jsp? I want to create hotel's... for="pack_meal"></label> <input type="checkbox
how to insert checkbox value into database using jsp
;   Here is a simple jsp code that insert the selected checkbox values...how to insert checkbox value into database using jsp  How to insert check box value to the oracle database using jsp? I want to create hotel's
getting and storing dropdown list in database in jsp
getting and storing dropdown list in database in jsp  i have a drop down list to select book from database. i'm able to retrieve dropdown list from database. but unable to store the selected value in database table. please help
How to access Contacts from gmail using LDAP in JSP dropdown list
How to access Contacts from gmail using LDAP in JSP dropdown list  HI, I am creating a JSP page in which i have to make a dropdown box, and access gmail contacts in that drop downlist using LDAP. Can any one plz help me out
How to backup a selected file from the dropDown Menu in JSP?
How to backup a selected file from the dropDown Menu in JSP?  I am trying to create a dropdown menu list for some type of files contained ina... file into the backup directory. I need the jsp code that can generate
how to use dropdown list in JSP and display value in same page
how to use dropdown list in JSP and display value in same page  I have a Dropdown list with some values say "A", "B" and "C" When the user selects... in the same page Value selected = C How can we do this in a JSP page
Checkbox Problem--Please Check this - JSP-Servlet
Checkbox Problem  I am facing a problem while creating a check box in JavaScript. Can any one share the part of code to create a checkbox in JavaScript
Values to listbox
Values to listbox  I have two textboxes by the name street and city.I have an add button and a name listbox. When I enter street and city and press the add button ,all the names of the people residing there are listed in listbox
dropdown
dropdown  I have a dropdown having 2 options-"Open"& "closed".When i select "open" option the related rows of data are retrieved from database and same with the other option.My database is Mysql and coding in PHP
listbox and textbox validations
listbox and textbox validations  hi, any one please tell me how to set validations for listbox and textboxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
CheckBox component in Echo3
application development are CheckBox, ListBox, Button and RadioButton. Here in this Check Box example we will describe you how to create CheckBox component in Echo3... CheckBox component in Echo3   
how to add data dynamically from database into a dropdown list in a jsp
how to add data dynamically from database into a dropdown list in a jsp  hi friends i am doing a project in jsp and oracle as my database.In my... and department fields also.I have a create an jsp page in which there should 2 drop down
JSP Get Data Into Dropdown list From Database
JSP Get Data Into Dropdown list From Database In this section we will discuss about how to fetch data dynamically into the dropdown list in JSP... fetching of data into the dropdown list in JSP using Eclipse IDE and the Tomcat 7
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct...  my project has login in whic i should select the company name in dropdown box.... so when i login i all the three username,password and dropdown box
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct...  my project has login in which i should select the company name in dropdown box.... so when i login i all the three username,password and dropdown box
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
how can i send a mail to a particular user from a many user dropdown list in jsp
how can i send a mail to a particular user from a many user dropdown list in jsp  how can i a sent a user question to a particular person from a drop down list in jsp