checkbox with dropdown listbox in jsp

Ads

 
 

Share on Google+Share on Google+

periasamy.s
checkbox with dropdown listbox in jsp
1 Answer(s)      6 years and 6 months 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:

<%@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
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
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
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 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
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  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
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
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 - 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 - 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
checkbox
checkbox  how to insert multiple values in database by using checkbox in jsp
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
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
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
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
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

Ads

 
Advertisement null

Ads