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

 
 


Ciaran Corson
JSP to add details to a database from a HTML form.
0 Answer(s)      a year and 5 months 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);
}
%>
View Answers









Related Pages:
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
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
Employee Details - JSP-Servlet
to tell u. Without submitting the form , you can't retrieve the data from database... in process.jsp, in Home Page. Because, for jsp or html elements like radio buttons... to do that, you have to forward form to either java action class or to some jsp (i.e
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   
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
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more.../JSP-Servlet/18899-data-grid-with-edit-and-delete-options-at-each-row-.html
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more.../JSP-Servlet/18899-data-grid-with-edit-and-delete-options-at-each-row-.html
Accessing database from JSP
Accessing database from JSP   ... a html page for inserting the values in 'books_details' table in database. After... in a relational database from your  JSP page. To do this, you need
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
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
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
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
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
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
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
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
storing date from html form to oracle 10g using servlet
this date month year from html form into oracle 10g database where i have...storing date from html form to oracle 10g using servlet  i have following html form from where date,month and year is retrieved separately.. <
storing date from html form to oracle 10g using servlet
this date month year from html form into oracle 10g database where i have...storing date from html form to oracle 10g using servlet  i have following html form from where date,month and year is retrieved separately.. <
web form(html) with jdbc
web form(html) with jdbc  need a example coding to develop a web form...: <html> <form method="post" action="http://localhost:8080/examples/jsp...(); out.println("Data is successfully inserted into database."); } catch
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
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
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
HTML
of the work,image of the work,points from the judges and above of this grid form i... where i can store in the database SEND ME THE CODE FOR THIS IN JAVA AND HTML...HTML  I want the following fields as in the form of grid view Fields
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
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
Login Form
; Login form in struts: Whenever you goes to access data from... on the server side with data entered from a form on the client side. It must have setters...; <html:form action="/userlogin" method="post"> <table
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
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
bank details - JSP-Servlet
is first to set the user account details in database, and the to create a login... is did is i created a database for users account details and created a login...bank details  hi i just need a coding for bank details... since iam
HTML
this field in form the data will be store into database.my database is the sql server... it shows as null. here is the html code for date of birth: <tr> <..._Year, i, i); } } </script> <form name="form" method="post" action
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
problem from registering a data in database with servlet - JSP-Servlet
problem from registering a data in database with servlet  Hi Rose, i created a servlet to validates ten user details in the database, if present... the user's details and submit into database. but it'll first insert the details
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
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
Display Data from Database in JSP
, to show data from the database click on the link that calls another .jsp file named...;body> <h2>Data from the table 'stu_info' of database 'student'</h2..._to_database_query.jsp. Click on the link given in the first jsp page,that calls
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
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
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 .   
to create registration form
fields from the user and add these values to database. 1)register.jsp: <... html and after those input fields by using jsp after that insert those input...://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
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
JSP Get Data From Database
JSP Get Data From Database In this section we will discuss about how to get data from database using JSP. To get data from database to a JSP page we... example which lets you understand to fetch data from database in JSP
Form Tag Example
from the form can be inserted into any HTML element on the page. Add... the form tag. The form tag is a UI tag that renders HTML an input form. The remote...:form>.It renders HTML as an input form formTag.jsp <
how to display data from jsp file into database
how to display data from jsp file into database  this is a jsp file...(); in the below example. the error is "cannot convert from java.sql.Statement..." contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page
Search data from database - Java Beginners
to user name. (means search all field from database and display using...Search data from database  Hi Deepak, This is not correct code I want this, Steps:- 1:- I hv a one form single name text box

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.