Powered by Blogger.

Thursday 8 September 2016

Spring MVC and Hibernate Tutorial

Spring is a lightweight framework. it provides support to various frameworks such as Hibernate, Struts, Tapestry, EJB, JSF, etc.
Modules: IOC(Inversion of control),  AOP(Aspect Oriented Programming), DAO(Data Access Object), Context,ORM(Object-relational Mapping), Web, MVC(Model View Controller). etc.

This is a step-by-step tutorial that helps you build a Spring-Hibernate application easily in a clear and concise way. In this first part, we demonstrate how to code a simple Spring MVC application that displays a list of users from MySQL database.
1. Create Database Name is demo and Database Table name is springhibernet.

Open NetBeans See The Menu Bar go to the file Menu Click on the New Project(Ctrl+Shift+N) and Select Left site categories Java/java web and Project categories to Right Site Project java/web Application .You have to give The Program Name "SpringHibernateTutorial". if you wont to save Project Location you can Browse and File save on the direction place and Gone a default Place and Now uncheck/check the check box and click on the next button, select server settings and select The Spring Web MVC Framework 4.0 and Hibernate Framework 4.3 and go to the finish.

This is automatic generated page code with custom according to performance.  
2.applicationContext.xml

3.dispatcher-servlet.xml

4.web.xml

5.redirect.jsp

There are default package with custom and controlling package classes.
6.default package
A. hibernate.cfg.xml

B. hibernate.reveng.xml

7. controlling package
  1. This is the Bean class and hbm file package name is "com.pojo.file".
A. Springhibernet.java

B. Springhibernet.hbm.xml

c. HibernateUtil.java

               2.  This is the view controlling package name is "com.spring.module".
A. view.java

Web browser page index.jsp and view.jsp.
8.index.jsp






9. view.jsp