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

Ads
 

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

Ads









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
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
Advertisements
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
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
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
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() { <
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code
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
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 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
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
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
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
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
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
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
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
jsp page to add users to mysql database
jsp page to add users to mysql database  <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@taglib uri="/WEB-INF/struts-bean.tld...-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Add
jsp page to add the user to mysql database
jsp page to add the user to mysql database  adduser.jsp: <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@taglib uri="/WEB-INF...;title>Add User</title> </head> <form name="user" action
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
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
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