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 ASAP else my boss will kill me :P :D

View Answers

November 1, 2011 at 11:34 AM

1)select.jsp:

<html>
<form method="post">
Select Programming Language:
<select name="lang">
<option value="C/C++">C/C++</option>
<option value="C#">C#</option>
<option value="Java">Java</option>
<option value="Perl">Perl</option>
<option value="Python">Python</option>
</select><br>
<input type="submit" value="Submit"><br>
</form>
</html>

2)insert.jsp:

<%@page import="java.sql.*"
<%
String selectedValue=request.getParameter("lang");
out.println("Selected Value is: "+selectedValue);
Class.forName("com.mysql.jdbc.Driver").newInstance();  
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  

Statement st=con.createStatement();
int i=st.executeUpdate("insert into data(language) values('"+selectedValue+"')");
out.println("Data is inserted successfully");

%>

November 1, 2011 at 11:39 AM

thanx for the quick response. i tried just lyk this. but it storing null value in the database. :\ what to do????









Related Tutorials/Questions & Answers:
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... lyk this. but it storing null value in the database. :\ what to do
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
Advertisements
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
getting values from dropdown list
getting values from dropdown list  I am having a dropdown list which... the database) My question is when i select a particular value it should be pass to the action. My action is getting called however, i am not sure how to pass
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... in storing them into the database,this registration form contains name
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... for fetching data from the database and set it into the dropdown list 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
getting problem in storing & retrieving value in database
getting problem in storing & retrieving value in database  Hello everyone i am doing a project where my back end is ms access & i want to store value like 5353250214 so if i store it as long int in access it wont take it &
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
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other... to create 3 drop dropdown list each depend on the other and get the options from the database using JSP. like country,state,city..please guide me
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... to the database and fetches an array of strings from a database table and then sends
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
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
getting values from database - JSP-Servlet
JSP code separately.If it will not display database values then try your code...getting values from database  I tried the following code abc.html aaa.jsp I am not getting exceptions now
storing details in database on clicking submit button - JSP-Servlet
storing details in database on clicking submit button  I am using JSP... database on clicking submit button. I am unable to do this.Can u tell me how to code...? JSP Page Name
Uploading a Software and storing in the database
Uploading a Software and storing in the database  I want to upload a software(may be of maximum 20mb) through JSP, and store it in the database. The coding present in the site for uploading and storing in the database
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
DropDown list
DropDown list  how to get mysql database values into dropdown usign java servlet and ajax?   Here is a jsp code that displays the database values into dropdown list. 1)country.jsp: <%@page import="java.sql.*"%>
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
inserting dropdown values into database table
inserting dropdown values into database table   hi i want to insert dropdown values into a database table by using jsp
struts dropdown list
struts dropdown list   In strtus how to set the dropdown list values from database ? I have a ArrayList object and set this object in dropdown jsp page using struts ? please send me jsp code... sample code: **Action
store dropdown box values in database server
store dropdown box values in database server  how to store dropdown box values in database server 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... to use this textbox value to fetch values from database
storing xml into database - XML
storing xml into database   hi i have an xml file it contains elements with attributes as well as nested elements so how to go forward .......with it i know how to persist a simple xml file into data base but i m finding some
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 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
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
dropdown list in jsf
dropdown list in jsf  I want to add a list box to display the country... then in the second list box it will display the states related to India only and the flow... with and without using database
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
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table...://www.roseindia.net/jsp/loginstatus.shtml
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
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
getting html list in a array
getting html list in a array  hi i want to get html unordered list in a array using jsp
getting html list in a array
getting html list in a array  hi i want to get html unordered list in a array using jsp
Retrieval of Dropdown list
Retrieval of Dropdown list  Hi frnds... Am having problem with the below code... I have retrieved data from the mysql database into dropdownlist ... for eg, let A1,A2,A3,A4 be the values in dropdown.. if i click A1
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 list and text fields in php
dropdown list and text fields in php  How could I use php to populate text fields by selecting a name of a business from dropdown list? Those text... number, description, and opening times from a mysql database. If you can, post
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
getting dropdown values using apache commons in servlet
getting dropdown values using apache commons in servlet  i want to get dropdown values in my program in order to merge the string to my file path so...); } i tried to debug and i am getting the wright file path but while proceeding
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
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
DropDown in ajax+jsp
DropDown in ajax+jsp  I have four dropdown if i select first dd... dropdown. You can create the fourth one similarly. For the above code, we have used 3 database tables: 1)country CREATE TABLE `country
Dropdown code to retrieve result from oracle database
that will retrieve values from the database into dropdown. As the user choose any option...Dropdown code to retrieve result from oracle database  Hi Friends, I... contains dropdowns in frontend(Javascript or JSP).If i choose an option,it should
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
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier problems somehow but now this time another problem arised when I want to pass the value from a link to a dropdown list. I want to set the dropdown list selected

Ads