This tutorial will demonstrate how to use JSTL tag library in combination with Spring Boot MVC applications.

First off, in order to use JSTL tag library in combination with Spring Boot MVC applications you need to include the following dependency set in your application:


Now, in order to configure JSP and JSTL usage in your Spring Boot application, add the following configuration class in your web application:

package com.example.cruddemo;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;

public class Config implements WebMvcConfigurer {

    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
    public void addViewControllers(ViewControllerRegistry registry) {

    public ViewResolver viewResolver() {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        return viewResolver;


Within this configuration class, we have configured:

  • A default View Controller for the index.html page which captures all requests for the root ("/") context
  • The org.springframework.web.servlet.view.JstlView Class as standard View class
  • The project path where JSP pages are searched in the webapp/WEB-INF/pages folder
  • The suffix for our views to be ".jsp"

With that in place, just add JSP pages with JSTL tags in the right project path, as in this example:

├── main
│   ├── java
│   │   └── com
│   │       └── example
│   │           └── cruddemo
│   │               ├──
│   │               ├── controllers
│   │               │   └──
│   │               ├──
│   │               ├── entities
│   │               │   └──
│   │               └── repositories
│   │                   └──
│   ├── resources
│   │   ├──
│   │   ├── data.sql
│   └── webapp
│       ├── index.html
│       ├── stylesheet.css
│       └── WEB-INF
│           └── pages
│               └── index.jsp

Now you can call your JSP pages either directly from the root Web context (ex. http://localhost:8080/index.jsp), or you can also reference them from a Controller:

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public ModelAndView listAction() {

        List<String> data = new ArrayList<>();

        ModelAndView mv = new ModelAndView();

        mv.addObject("data", data);

        return mv;


And finally, here is the index.jsp page which iterates over a list of Customer objects, passed as a Model from the Controller:

<%@ page isELIgnored="false" %>
<%@taglib prefix="c" uri=""%>


  <h2>How to iterate list on JSP in Spring MVC</h2>

    <div align="left">
        <table border="1" cellpadding="5">
            <caption><h2>List of Customers</h2></caption>
            <c:forEach var="user" items="${listCustomers}">
                    <td><c:out value="${}" /></td>
                    <td><c:out value="${}" /></td>
                    <td><c:out value="${user.surname}" /></td>

Here is your application in action:

spring boot jstl   tutorial spring boot jstl tutorial

Source code for this tutorial:

FREE WildFly Application Server - JBoss - Quarkus - Drools Tutorials