checkbox with dropdown listbox in jsp

Ads
 

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);
 }

 %>

Ads









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
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
Advertisements
JSP CheckBox
JSP CheckBox          JSP CheckBox is used to create a CheckBox in JSP... illustrate an elaborate example from 'JSP CheckBox'. To understand and grasp
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
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
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
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
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
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 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
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file 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 in JSP. Further, you can know in details about the multiple chechbox values
checkbox
checkbox  how to insert multiple values in database by using checkbox 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
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")%>"><
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
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
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
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
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 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 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   
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
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  how to hide textbox field when i deselect from select dropdown

Ads