Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
Spring - MVC Framework
Next article icon

Spring MVC Tutorial

Last Updated : 02 Jan, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In this tutorial, we'll cover the fundamentals of Spring MVC, including setting up your development environment, understanding the MVC architecture, handling requests and responses, managing forms, and integrating with databases. You'll learn how to create dynamic web pages, handle user input, and implement robust web applications using Spring MVC's proven methodologies.

If we are to be more precise, then this Spring MVC tutorial covers all the basic to advanced topics of Spring MVC like Basics of Spring MVC, Spring MVC Annotation, Spring MVC Architecture, Spring MVC Flow, Spring Form Handling, Spring MVC with JSTL, Spring MVC with REST API, etc.

Spring MVC Tutorial

What is Spring MVC?

Spring MVC is a Java-based framework that is mostly used for developing web applications. It follows the MVC (Model-View-Controller) Design Pattern. This design pattern specifies that an application consists of a data model, presentation information, and control information.

This framework is developed around a DispatcherServlet which dispatches requests to handlers. In the current industry, many of them are using Spring Boot Microservices, but there are many projects still running in Spring MVC. So it is worth learning Spring MVC in the recent era. That’s why we are going to cover all the things which are part of the Spring MVC framework one by one in an organized manner.

Spring Model-View-Controller

  • Model - A model contains the application's data. A data set might be a single object or a group of things.
  • Controller - A controller houses an application's business logic. The @Controller annotation is used here to identify the class as the controller.
  • View - A view is a representation of the delivered information in a certain format. In most cases, JSP+JSTL is utilized to construct a view page. Spring does, however, support additional view technologies such as Apache Velocity, Thymeleaf, and FreeMarker.
  • Front Controller - The DispatcherServlet class serves as the front controller in Spring Web MVC. It is in charge of managing the flow of the Spring MVC application.

Table of Content

  • What is Spring MVC?
  • Spring Model-View-Controller
  • Spring MVC – Basics
  • Spring MVC – Software Setup and Configuration (STS/Eclipse)
  • Prerequisite (Spring Core Concepts)
  • Core Spring MVC
  • Spring MVC – Annotation
  • Spring MVC – Form Handling
  • Spring MVC with JSTL
  • Spring MVC with REST API
  • Spring MVC with Database
  • Advantages of Spring MVC Framework

Spring MVC – Basics

  • Introduction to Spring MVC
  • What is Dispatcher Servlet in Spring?
  • Difference between Spring MVC and Spring Boot

Spring MVC – Software Setup and Configuration (STS/Eclipse)

  • How to Download and Install Spring Tool Suite (Spring Tools 4 for Eclipse) IDE?
  • How to Download and Install Eclipse on Windows?
  • How to Create a Dynamic Web Project in Eclipse/Spring Tool Suite?

Prerequisite (Spring Core Concepts)

In this section, we will learn some of the essential Spring Core Concepts as prerequisites. If you already know these concepts, then you can skip this section.

  • Understanding Inversion of Control with Example
  • Spring – BeanFactory
  • Spring – ApplicationContext
  • Spring – Difference Between BeanFactory and ApplicationContext
  • Spring Dependency Injection with Example
  • Spring – Difference Between Inversion of Control and Dependency Injection
  • Spring – Injecting Objects By Constructor Injection
  • Spring – Dependency Injection by Setter Method
  • Spring – Injecting Objects by Setter Injection
  • Spring – Injecting Literal Values By Setter Injection
  • Spring – Injecting Literal Values By Constructor Injection
  • Bean life cycle in Java Spring
  • Custom Bean Scope in Spring
  • How to Create a Spring Bean in 3 Different Ways?
  • Spring – IoC Container
  • Spring – Autowiring
  • Singleton and Prototype Bean Scopes in Java Spring
  • How to Configure Dispatcher Servlet in web.xml File?

Core Spring MVC

  • How to Create Your First Model in Spring MVC?
  • How to Create Your First View in Spring MVC?
  • Create and Run Your First Spring MVC Controller in Eclipse/Spring Tool Suite
  • Spring MVC – Multi Action Controller with Example
  • Spring MVC using Java-based configuration
  • ViewResolver in Spring MVC
  • Spring – Shortcut to Create Dispatcher Servlet in Eclipse/Spring Tool Suite
  • WebApplicationContext in Spring MVC
  • Data Transfer Object (DTO) in Spring MVC with Example
  • Data Binding in Spring MVC with Example
  • Spring MVC – Pagination with Example
  • Difference Between ApplicationContext and WebApplicationContext in Spring MVC
  • Spring MVC – Exception Handling
  • Spring – How to Load Literal Values From Properties File
  • Spring MVC – Multiple View Page
  • Spring MVC - Custom Validation
  • Spring MVC - Listbox
  • Spring MVC – Multiple Resolver Mapping
  • Spring MVC - File Upload
  • Spring MVC - TextArea
  • Spring MVC - Hidden Field
  • Spring MVC - Regular Expression Validation
  • Spring MVC - Password
  • Spring MVC - Validation
  • Spring MVC – Tiles
  • Spring MVC – Text Box
  • Spring MVC – Multiple Controller
  • Spring MVC – Model Interface
  • Spring MVC – Number Validation
  • Spring MVC - Application Without web.xml File
  • Query String and Query Parameter in Spring MVC
  • Two-Way Data Binding in Spring MVC with Example
  • How to Resolve WEB xml is missing and failOnMissingWebXml is set to true in Eclipse/STS?

Spring MVC – Annotation

  • Spring MVC @RequestParam Annotation
  • Spring @RequestMapping Annotation with Example
  • How to Capture Data using @RequestParam Annotation in Spring?
  • Spring @ResponseBody Annotation with Example
  • Spring MVC @ModelAttribute Annotation with Example
  • Difference Between @Component, @Repository, @Service, and @Controller Annotations in Spring
  • Difference Between @Controller and @Service Annotation in Spring
  • Difference Between @Controller and @RestController Annotation in Spring

Spring MVC – Form Handling

  • Spring MVC - Form Handling
  • Spring MVC - Form Checkbox
  • Spring MVC - Form Radio Button
  • Spring MVC - Form Drop-Down List
  • Spring MVC - Form Tag Library
  • Spring MVC - Form Text Field
  • Spring MVC – Capture and Display the Data from the Registration Form
  • Spring MVC – Create Registration Form using Form Tag Library

Spring MVC with JSTL

  • Spring MVC – Basic Example using JSTL
  • Spring MVC JSTL Configuration
  • Spring MVC – JSTL forEach Tag with Example
  • Spring MVC – Iterating List on JSP using JSTL

Spring MVC with REST API

  • How to Make Post Request in Java Spring?
  • How to Make get() Method Request in Java Spring?
  • How to Make Delete Request in Spring?
  • Spring MVC – Get University/College Details via REST API
  • Spring MVC Project – Retrieving Population, Area, and Region Details using Rest API
  • Spring MVC – Last 24-Hour Cryptocurrency Data using REST API
  • Spring MVC – Comparison of Cryptocurrencies using REST API
  • Spring MVC – Get Probability of a Gender by Providing a Name using REST API
  • OpenSource REST API URL and Retrieving Data From it By Using Spring MVC
  • How to Extract TV Show Details via REST API and Spring MVC?
  • Get Time Zone by Providing Latitude and Longitude using Spring MVC and REST API
  • Spring MVC – Getting Cryptocurrency Details using REST API
  • Spring MVC – Get Exchange Rate Values using REST API

Spring MVC with Database

  • Spring MVC CRUD with Example
  • How to Create a Project Using Spring MVC and Hibernate 5?
  • Spring MVC – Sample Project For Finding Doctors Online with MySQL
  • Spring MVC Integration with MySQL
  • Spring MVC with MySQL – Sample Project For Calculating Electricity Bill
  • Spring MVC with MySQL and Junit – Finding Employees Based on Location

Advantages of Spring MVC Framework

  • Separate roles
  • Lightweight
  • Powerful Configuration
  • Rapid development
  • Reusable business code
  • Easy to test
  • Flexible Mapping

Conclusion

Throughout this tutorial, you've learned essential concepts such as request handling, form submission, database integration, and more Spring MVC's structured approach to web development empowers you to create scalable and maintainable applications. Whether you're developing e-commerce platforms, social media sites, or enterprise solutions, the skills you've acquired here will prove invaluable.


Next Article
Spring - MVC Framework

A

AmiyaRanjanRout
Improve
Article Tags :
  • Java
  • Java-Spring-MVC
  • Tutorials
Practice Tags :
  • Java

Similar Reads

    Spring MVC Tutorial
    In this tutorial, we'll cover the fundamentals of Spring MVC, including setting up your development environment, understanding the MVC architecture, handling requests and responses, managing forms, and integrating with databases. You'll learn how to create dynamic web pages, handle user input, and i
    7 min read
    Spring - MVC Framework
    The Spring MVC Framework follows the Model-View-Controller architectural design pattern, which works around the Front Controller, i.e., the Dispatcher Servlet. The Dispatcher Servlet handles and dispatches all incoming HTTP requests to the appropriate controller. It uses @Controller and @RequestMapp
    4 min read
    Spring MVC using Java Based Configuration
    Spring MVC framework enables the separation of modules, namely Model, View, and Controller, and seamlessly handles application integration. This enables the developer to create complex applications using plain Java classes. The model object can be passed between the view and the controller using map
    3 min read
    ViewResolver in Spring MVC
    Spring MVC is a powerful Web MVC Framework for building web applications. It provides a structured way to develop web applications by separating concerns into Model, View, and Controller. One of the key features of Spring MVC is the ViewResolver, which enables you to render models in the browser wit
    7 min read
    How to Create Your First Model in Spring MVC?
    Spring MVC is a powerful Web MVC framework for building web applications. It is designed around the Model-View-Controller (MVC) pattern, which separates the application into three main components:Model: Represents the data of the application. It can be a single object or a collection of objects.View
    6 min read
    How to Create Your First View in Spring MVC?
    Spring MVC is a powerful Web MVC Framework for building web applications. It is designed around the Model-View-Controller (MVC) pattern, which separates the application into three main components:Model: Represents the data of the application. It can be a single object or a collection of objects.View
    5 min read
    Spring MVC CRUD with Example
    In this article, we will explore how to build a Spring MVC CRUD application from scratch. CRUD stands for Create, Read/Retrieve, Update, and Delete. These are the four basic operations to create any type of project. Spring MVC is a popular framework for building web applications. Spring MVC follows
    7 min read
    Create and Run Your First Spring MVC Controller in Eclipse/Spring Tool Suite
    Spring MVC framework enables the separation of modules, namely Model, View, and Controller, and seamlessly handles the application integration. This enables the developer to create complex applications also using plain Java classes. The model object can be passed between the view and the controller
    5 min read
    What is Dispatcher Servlet in Spring?
    Spring is one of the most popular Java EE frameworks. It is an open-source lightweight framework that allows Java EE 7 developers to build simple, reliable, and scalable enterprise applications. This framework mainly focuses on providing various ways to help you manage your business objects. It made
    6 min read
    Spring - Shortcut to Create Dispatcher Servlet in Eclipse/Spring Tool Suite
    Eclipse is an Integrated Development Environment (IDE) used in computer programming. It includes a base workspace and an extensible plug-in system for customizing the environment. It is the second-most-popular IDE for Java development. Eclipse is written mostly in Java and its primary use is for dev
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences