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



Home Answers Viewqa JSP-Servlet JSP to add details to a database from a HTML form.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ciaran Corson
JSP to add details to a database from a HTML form.
0 Answer(s)      3 years ago
Posted in : JSP-Servlet


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);
}
%>

Advertisement
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
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
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
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
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
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
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
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
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   
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 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
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
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
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
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
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
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
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() { <
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
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
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
Accessing database from JSP
Accessing database from JSP   ... database from your  JSP page. To do this, you need to use ... In This article I am going to discuss the connectivity from MYSQL database with JSP.we
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
Advertisements
 

 

 

DMCA.com