Updating database using servlet
When the user submits his or her selection in the welcome page's HTML form, the submit initiates a request for the response page ( tables and inserts it into to the page, allowing the user to view data based upon his or her selection when the page is returned to the browser.In order to implement the scenario described above, you develop a simple application for a fictitious organization named IFPWAFCAD, The International Former Professional Wrestlers' Association for Counseling and Development. The welcome page implements an HTML form that is used to capture user data. Place this file in src of your project by default it will added to classpath of your project. Http Servlet Response; public class Success extends Http Servlet The configuration file contains informations about the database and mapping file. Configuration file must be in classpath of your Project.
The application you build in this tutorial involves the creation of two JSP pages.
These data we will collect in servlet and finally insert these data into Database by using hibernate. User DAO; public class User Controller Servlet extends Http Servlet Above class is controller class for our application.
For creating the web application, we are using JSP for presentation logic, Servlet class for controller layer and DAO class for database access codes. In this class we are collecting the data from user and storing the data by calling User DAO class add User Details method.
In this tutorial, we are going to create a web application with hibernate. If the database insertion is successful request will be forwarded to Servlet class. In this class we have implemented add User Details() method where we are adding the user details to database by using hibernate.
We are going to insert the record of the user in the database. Create a package hibernate.dao,in this package create java class User and add following code in this class.
My SQL is a popular open source database management system commonly used in web applications due to its speed, flexibility and reliability.