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
Advertisements
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
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
Accessing database from JSP
Accessing
database from JSP
 ... Tutorial: How to access MySQL
database from JSP?
JSP Code
The following code...
In This article I am going to discuss the connectivity
from MYSQL
database with JSP.we
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 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
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
Inserting data from the HTML page to the database
Inserting data
from the
HTML page to the
database... program in which
we are going to insert the values in the
database table
from the
html form.
To make our program working we need to make one
html
form
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
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
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
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