Javatpoint Logo

91-9990449935

 0120-4256464

Web Application with Hibernate

Here, we are going to create a web application with hibernate. For creating the web application, we are using JSP for presentation logic, Bean class for representing data and DAO class for database codes.

As we create the simple application in hibernate, we don't need to perform any extra operations in hibernate for creating web application. In such case, we are getting the value from the user using the JSP file.


Example to create web application using hibernate

In this example, we are going to insert the record of the user in the database. It is simply a registration form.


index.jsp

This page gets input from the user and sends it to the register.jsp file using post method.


register.jsp

This file gets all request parameters and stores this information into an object of User class. Further, it calls the register method of UserDao class passing the User class object.


User.java

It is the simple bean class representing the Persistent class in hibernate.


user.hbm.xml

It maps the User class with the table of the database.


UserDao.java

A Dao class, containing method to store the instance of User class.


hibernate.cfg.xml

It is a configuration file, containing informations about the database and mapping file.


Next TopicGenerator Classes