Spring MVC Notes PDF
Document Details
Uploaded by Deleted User
Tags
Summary
These notes detail Spring MVC, a software development framework. It includes an overview of the MVC architectural pattern and steps to set up a Spring MVC project using Maven. The document also mentions dependencies, configuration, and provides some useful coding examples.
Full Transcript
Spring MVC Any application consists of three layers those are: 1\. Presentation layer : this layer of an application deals with user interaction with the application. 2\. Business logic : this layer of an application deals with data processing and database connectivity. 3\. Database layer : this...
Spring MVC Any application consists of three layers those are: 1\. Presentation layer : this layer of an application deals with user interaction with the application. 2\. Business logic : this layer of an application deals with data processing and database connectivity. 3\. Database layer : this layer of an application deals with data management and data storage. Monolithic application : If all the above layers of an application are present as a single application then that application is called as monolithic application. MVC MVC stands for model, view, controller. It is an architectural design pattern which is used to develop monolithic application. ![](media/image2.png) 1\. Model : model represents business logic of an application along with the database connectivity. 2\. View : view represents presentation layer or user interface. 3\. Controller : controller acts like an interface between view and model. Controller controls all the requests and responses. Detailed spring MVC architecture steps to create maven project (archetype web app version 1.5) step 1. press ctrl + N and search for maven project and select the maven project option step 2. Don't skip the architype selection and click on next step 3. in next window apply the filter as org.apache.maven and select the maven-archetype-webapp (1.5) step 4. in the next window provide the appropriate group id and artifact id and uncheck the checkbox saying "run architype generation interactively" and click on finish. Add required folders If the project is created with some missing folders then we can follow some following steps to add those missing folders step 1. select the project folder and right click. Go to build path and click on configure build path option. step 2. Go to order and export section and click on select all option and the click on apply and close. Dependencies required for spring MVC project 1\. MySQL connector 2\. Hibernate core relocation 3\. Java servlet API 4\. JSP API (Java Server Pages API) 5\. Spring context 6\. Spring web MVC 7\. Project Lombok steps to update maven project step 1. Select the project folder and right click step 2. go to an option called as maven and select the option as update project step 3. in the next window select the maven project to be updated, check the check box as force update of Snapshots / Releases and then click on ok. If still the error is there then right click on the project and click on refresh. Configuration of web.xml Location : src/main/webapp/WEB-INF/web.xml \ \Dispatcher\ \org.springframework.web.servlet.DispatcherServlet\ \ \ \Dispatcher\ \/\ \ To get the qualified name of the DispatcherServlet , press ctrl + shift + T, search for DispatcherServlet, select the appropriate class and open its implementation and copy its qualified name. Dispatcher-servlet.xml Location : src/main/webapp/WEB-INF/Dispatcher-servlet.xml \