JSP to add details to a database from a HTML form.

JSP to add details to a database from a HTML form.

Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details entered into a database. The files are all in one folder for use in tomcat... I'm getting an error that I need to remove the tokens.. A lot of them it thinks..

Can anyone tell me what is wrong with my code? html code first , then the jsp validation side after below..

<html>
<body>
<center>
<form action="Registration.jsp">
<table border="1">
<td>
Welcome , please enter your details
<td>
</table>
Username<input type ="text" name="username"><br/>
Password<input type ="password" name ="password"><br/>
Firstname<input type ="text" name="Firstname"><br/>
Surname<input type ="text" name="Surname"><br/>
City<input type ="text" name="City"><br/>
<input type ="submit" value ="Register">
</form>
<center>
</body>
</html>


<%@ page contentType = "text/html" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>

<sql:setDataSource
var ="booksDb"
scope = "session"
driver = "sun.jdbc.odbc.JdbcOdbcDriver"
url = "jdbc:odbc:Driver = {Microsoft Access Driver(*.mdb)};DBQ=Labdb.mdb"
/>


<%
String User = request.getParameter("username")  <%-- gets the parameter username from form and stores it in User--%>
String Pword = request.getParameter("password")
String fname = request.getParameter("firstname")
String sname = request.getParameter("surname")
String city1 = request.getParameter("city")

%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:Driver = {Microsoft Access Driver(*.mdb)};DBQ=Labdb.mdb", "root", "Users");
PreparedStatement ps=conn.prepareStatement("INSERT INTO memory VALUES (?,?,?,?,?,?,?,?)");

ps.setString(1,User);
ps.setString(2,Pword);
ps.setString(3,fname);
ps.setString(4,sname);
ps.setString(5,city);
ps.execute();

conn.close();
}catch(Exception e)
{
out.println(e);
}
%>
View Answers









Related Tutorials/Questions & Answers:
JSP to add details to a database from a HTML form.
JSP to add details to a database from a HTML form.  Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details... from form and stores it in User--%> String Pword = request.getParameter
jsp or sevlet and html form to send picture to database - JSP-Servlet
jsp or sevlet and html form to send picture to database  Hello guys... that contains his picture to database. What I need are html page for the form that will browse for the picture, jsp or servlet that the info from html will go
Advertisements
retrive the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
HTML(Registration form) to Jsp to stored into MS ACCESS database
HTML(Registration form) to Jsp to stored into MS ACCESS database  i am sending one html file that contain 18 fields these are stored in ms-access database by using jsp code.i want to urgent jsp code. please urgent sir. thank
How to retrieve array values from html form to jsp?
How to retrieve array values from html form to jsp?  Hi! I am... it into jsp. Means i just want to retrieve values from html form containing array... sample code for how to retrive array values from html to jsp.   hi friend
html form - JSP-Servlet
html form  how to retrieve database value in dropdown list box placed in html form  Hi friend, Visit for more information. http://www.roseindia.net/jsp/ Thanks
how to pass form values from javascript of html page to jsp page
how to pass form values from javascript of html page to jsp page   This is my sample html page which contains inline javascript which calculates... to submit all the form values with lattitude and longitude returned from
upload file and insert other details to database using a single form
upload file and insert other details to database using a single form  ... which I retrieved from another jsp/html page. Here i was able to upload file but my other details seem to be null
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 ... in storing them into the database,this registration form contains name... get dynamically from the database and whenever a new person has registered his
convert this html form to jsp
convert this html form to jsp  <html> <head> <script...="blackboldtxt"><font color="#ffffff" size=5><b>Add Village Details</b>...;/tr> <form name="VillageDetailsForm" action="AddVillage.jsp" method
ACCESS DATABASE FROM HTML
ACCESS DATABASE FROM HTML  I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Access database in html page(client side
JSP:HTML Form in-place Editing - JSP-Servlet
JSP:HTML Form in-place Editing  I have an HTML form (form #1) which... in the database) after which I want to re-populate the form so that if the user... from a stringquery into another page and having the same form, for some reason
Servlet to add the data into database
the data in the database table from a html form.  This servlet program... from the HTML form will be retrieved by the server side program i.e. servlet. ... Servlet to add the data into database   
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
Sending form data from HTML page to SQLserver 2005 database by calling servlet code
Sending form data from HTML page to SQLserver 2005 database by calling servlet code  Hi sir, I would like to know how to send the form data from html page to database by calling servlet code from html page .   
How to get the text from textarea in HTML and store it in database using javascript and jsp
How to get the text from textarea in HTML and store it in database using javascript and jsp  How to get the text from textarea in HTML and store it in database using javascript and jsp <script> function str() { <
how to retrieve text and images from mysql database and show on html page using jsp servlet
how to retrieve text and images from mysql database and show on html page using jsp servlet  <%@ page language="java" contentType="text/html... Complaints: Complaint Timing User Name Complaint Details Complaint Images
calling java method from html form with out using javascript - JSP-Servlet
calling java method from html form with out using javascript  How can i call java method from a HTML form, java script should be disabled?  ...;script LANGUAGE="JavaScript">function testResults(form
JSP:HTML Form in-place Editing - JSP-Servlet
JSP:HTML Form in-place Editing  Hi, I want to thank the people... developer's needs. This is a follow up to the HTML Form in-place editing. The code... an excellent way of editing a form. I just have a few adjustments if any of you could
Upload csv or .xlsx file from JSP form to Database Table using servlet
Upload csv or .xlsx file from JSP form to Database Table using servlet ... and stores it into the oracle database table. Sir Its very Urgent I have... { response.setContentType("text/html"); PrintWriter out
How to extract details from XML? - JSP-Servlet
How to extract details from XML?  I want to extract details from http://service.openkapow.com/palanikumar/airportantigua.rest How can i extract details from this link?Here is my program... Airport
storing details in database on clicking submit button - JSP-Servlet
storing details in database on clicking submit button  I am using JSP in NetBeans and have developed an application form which has fileds naming 'Name' and 'ID'.I want to store the details of these two fields in the MYSQL
Inserting data from the HTML page to the database
Inserting data from the HTML page to the database... have got from the html will be set in the database by using the setString... program in which we are going to insert the values in the database table from
Data fetching from JSP or HTML - JSP-Servlet
Data fetching from JSP or HTML  Hi Deepak, Can u pls help me as i have a problem with jsp/html frameset. my question is how can i fetch the data from frameset which is in html format.pls help me. Thanks
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code
Uploading file in servlet from a html form
Uploading file in servlet from a html form  Sir, I want to upload a picture from my html file and save it to my database as BLOB,but what JAR should i use for this purpose i am really confused about.And also is it possible to do
Update Database from jsp
Update Database from jsp   I want to update my oracle database column from a text box ,so whenever I input some text value in the text box and click UPDATE button the database field should be updated . I have a drop down menu
image upload with jsp from form
image upload with jsp from form  hi i used the code specified in your following post http://www.roseindia.net/answers/viewqa/JSP-Servlet/9749-image...) org.apache.jsp.upload_jsp._jspService(upload_jsp.java:85
Accessing database from JSP
Accessing database from JSP   ...; in database "books" Video Tutorial: How to access MySQL database from JSP... in a relational database from your  JSP page. To do this, you need to use 
How to access the database from JSP?
How to access the database from JSP?  Hi, What is the process of accessing the database from JSP page? Thanks   Hi, In the JSP program... database from JSP which explains you how to access the database by embedding
Exception during parsing a parameter from the form in JSP
Exception during parsing a parameter from the form in JSP  Exception during parsing params from a form? I get parameters from a html form. I parse the integer one in the JSP file, but I get exception. Is there anyway I can get
how to write a jsp form using html
how to write a jsp form using html  hi, i have written the code as below... but it is showing error. please help me how to resolve it. .html file...; <body> <form method="POST" action="Form1.jsp"> EmployeeNo: <
display date to jsp from database
display date to jsp from database   display date to jsp from database to calender if the start date and end date is available than calender date... not available in database field than show in green color and clickable. NOTE :- Date
How to pass parametes from JSP page to HTML page? - JSP-Servlet
How to pass parametes from JSP page to HTML page?  Hi all, In my project I have one JSP page and one HTML page. In JSP page I have created HTML... to pass the values from my JSP page to HTML page. Pls help me out. Hitendra 
JSP Ajax Form
Ajax Form Example This example explains you how to develop a form that populates dynamically from the database though Ajax call. When user selects employee id from the combo box then the corresponding employee details are populated
Html+jsp+database is enough to do the small operation
Html+jsp+database is enough to do the small operation  Hai , If u... not to bother about whole code.just u consentration on html,ajax,jsp,any db.here i am using db2. Html for insertion: <form name="StudentForm" method="post
Connecting to Database from a hyperlink in JSP - JSP-Servlet
Connecting to Database from a hyperlink in JSP  How can I connect to database by clicking on a hyperlink in a JSP Page.Can you please give me sample... which is connect to database using jdbc database
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like
Link from html to jsp - Development process
Friend, To give link from html page to jsp, you have to run the jsp page.After...Link from html to jsp   Hi, Can u send me code. when i click html link button , control should go to jsp page wat i mentioned in view
database connectivity in jsp form
database connectivity in jsp form We are going to create jsp registration form database. We first create simple registration form. All data will be stored in he database. We use method getParameter() that return the value
how to insert data in database using html+jsp
how to insert data in database using html+jsp  anyone know what...; Here we have used MySQL database: 1)form.html: <html> <form... and database name. Here machine name id localhost and database name
retrive data from database using jsp in struts?
retrive data from database using jsp in struts?   *search.jsp* <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <... searchProduct(SearchDTO sdto) { String query="select * from product
add cookies to login form in jsp by using struts2.0 framework
add cookies to login form in jsp by using struts2.0 framework  hi sir... struts2.0 and hibernate3.0 and mysql database for login .jsp now i want to add cookies to above form please help me
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database

Ads