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



Home Answers Viewqa JSP-Servlet how to update combobx's selected value to database with respect toselected multiple checkboxes
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


archana pande
how to update combobx's selected value to database with respect toselected multiple checkboxes
0 Answer(s)      a year and 8 months ago
Posted in : JSP-Servlet


suppose this if form1.jsp in which i am going to display records from database
out.println("<tr><td>"+"<input type='checkbox' id='r1' value="+r+" name='test' >"+"</td><td>"+r+"</td><td>"+pname+"</td><td>"+add1+"</td><td>"+add2+"</td><td>"+land+"</td><td>"+geon+"</td><td>"+geoe+"</td><td>"+plan+"</td>");

 out.println("<td><select name='routecombo'id='routecombo'"+i+"'>");
  ResultSet rs1=ps2.executeQuery("select Route_id from table1");
  while(rs1.next())
  {
  s1=rs1.getString(1);
  out.println("<option value='"+s1+"'>"+s1+"</option>");
  }

 out.println("</select>");
 out.println("</td>");


  out.println("</tr>");


now this is form2.jsp in which i am updating values which is selected from form1.jsp
String languages="";
String box="";
String box1="";
String lang[]=request.getParameterValues("test");
String txt[]=request.getParameterValues("routecombo");

for(k=1;k<=lang.length;k++)
            {
                System.out.println("k: "+k);
                languages+=lang[k-1]+" ";
            }
               System.out.println("chk="+languages);
               int j=0;
                for(t=0;t<txt.length;t++){

                    box+=txt[t];
                    //box1+=txt1[t];
                    //System.out.println("txt="+box);
                    if(!((txt[t]).equals("")))
                    {
                        System.out.println("Route ID");
                        System.out.println(t);
                        System.out.println(txt[t]);
                        String query="update PROFILE set Route_Id='"+txt[t]+"' where Proid='"+lang[j]+"'";
                        System.out.println(query);
                        i=st.executeUpdate(query);
                        j++;
                    }
 System.out.println("txt="+box);
                //System.out.println("txt1="+box1);

        out.println("Data is successfully inserted into database.");
        }
        catch(Exception e){
            e.printStackTrace();
        System.out.println(e);
        }

Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to update combobx's selected value to database with respect toselected multiple checkboxes
how to update combobx's selected value to database with respect toselected multiple checkboxes   suppose this if form1.jsp in which i am going to display records from database out.println("<tr><td>"+"<input type
want to ask how to update data for runtime selected multiple checkboxes
want to ask how to update data for runtime selected multiple checkboxes  HI I have one problem I have fetched value from oracle database into grid... have checkboxes for each record when I will select more than one checkboxex
Advertisements
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons...) is available in DB,the respective radio button should be selected automatically
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement - Java Beginners
How to insert multiple checkboxes into Msaccess database J2EE using prepared... statement to do the checked boxes part, I'm not sure how to go about doing... for different subjects, you can insert the multiple subjects in one column
I want to update the multiple values of database depending on checkbox..? Please help me out..
I want to update the multiple values of database depending on checkbox..? Please help me out..   Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
Update value of database using hibernate.
Update value of database using hibernate.  How to update value of database using hibernate?   Hibernate provides facility to update... this by setting the value and calling the update method. session.update(employee
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
Retriving multiple values of checkboxes in struts
Retriving multiple values of checkboxes in struts  how to retrive multiple values of checkboxes of jsp in action class   JSP Retrieve...="lang" value="C/C++">C/C++<br> <input type="checkbox" name="lang
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... submit i want to display other field. how to get it?? plz help me
how to update checkbox list in database
how to update checkbox list in database  Issues: i am using... to update one by one but it's not updating by using below code .it's not adding... in the database below logic is working fine by using insert command
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want to maintain the financial database of 20 users for 1 year and update the details in jsp page.. so i have decided to maintain the details based on month (because
how to display textbox value based on selected option value?
how to display textbox value based on selected option value?  Hi,I... on first value I finished above code. ID: xx Name:xx xx is baesd on second and first value. But it is that l can't do that. now, l post my code
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
the checkboxes selected across different pages will get submitted. Can somebody help me how to maintain States of Selected CheckBoxes in Different Pages using...Maintaining States of Selected CheckBoxes in Different Pages using dispaly
Update value
Update value  How to update value of database using hibernate ?   Hi Samar, With the help of this code, you will see how can update database using hibernate. package net.roseindia.DAO; import
how to know which jList is selected and according to that fetch the value
how to know which jList is selected and according to that fetch the value ... is selected so that i get the value of employee_id from the correct jList (i.e which is selected) to fetch data from database using selected employee id from selected
how to read the values for text and csv files and store those values into database in multiple rows..means one value for one row
into database in multiple rows..means one value for one row  Hai, I need... table in multiple rows(which means one value for one row). eg: my file containes... stored in database like names(column) siva divya ravi one value for one
update database
update database  hi.. i want to know how the valuesof database can... that can be done there then by pressing the update buutton the value can be updated to database
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below...="destination" onchange="getPrice()"> <html:option value="0">...;<input type="text" value =" " property= "amount" id='pricecheck'/> <
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below...="destination" onchange="getPrice()"> <html:option value="0">...;<input type="text" value =" " property= "amount" id='pricecheck'/>
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to store JComboBox selected Item into Ms Access Database  How to store JComboBox selected Item into Ms Access Database.  Hi Friend, Try the following code: import java.sql.*; import javax.swing.*; import
how update JTable after adding a row into database
in JTable, and it's OK, but after adding a row into database table does't update. How update JTable after adding a row into database? package djile pak.java...how update JTable after adding a row into database  J have two
How to save JCombobox Selected Item in to Access Database - Java Beginners
How to save JCombobox Selected Item in to Access Database  How to save JCombobox Selected Item in to Access Database  Hi Friend, Try the following code: import java.sql.*; import javax.swing.*; import
Java swing: get selected value from combobox
Java swing: get selected value from combobox In this tutorial, you will learn how to get selected value from combobox. The combobox provides the list... imposed an actionlistener on the combobox in order to get the selected value from
 

 

 

DMCA.com