Spring MVC Hibernate MySQL CRUD Operation

Spring MVC Hibernate MySQL CRUD Operation:
The idea of MVC framework is to separate the business logic from front end and change them without affecting others.

Model: Represents data
View: User Interface of the application
Controller: Receives request and perform the operations

 

  • The request is received by the dispatcher servlet
  • The dispatcher Servlet checks with the Handler Mappings to determine the appropriate controller to pass the request
  • The dispatcher Servlet get the appropriate controller from Handler Mapping and passes the request to Controller.
  • The controller sends the request along with the object containing the name of the view and data to be displayed, but not the exact logical name
  • Dispatcher Servlet after receiving the name, checks with view resolver to resolve the actual logical name.
  • Finally the view is displayed to the user

Now let us see the example of Spring MVC, Hibernate with MySQL.

Project Structure:

pom.xml

Employee.java

EmployeeDAO

EmployeeDAOImpl.java

EmployeeService

EmployeeServiceImpl

EmployeeController.java

 

spring-config.xml

web.xml

employee.jsp

edit.jsp

Output:

On clicking Edit

 

Create Another record,

Deleting Alpha record,

 

 

 

 

Read More