Share on Google+Share on Google+

periasamy.s
checkbox with dropdown listbox in jsp
1 Answer(s)      6 years ago
Posted in : JSP-Servlet

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....

Ads

View Answers

April 7, 2011 at 1:56 PM


1)select.jsp:

<[email protected] 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:

<[email protected] 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: ByDefault first... it should show 1st and 2nd page's selected listbox as well as checkbox list from
Advertisements
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 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
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          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
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
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
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
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
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
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
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
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
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
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
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
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
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
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")%>">
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   
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
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads