Spring MVC JSTL Configuration Example

Learn to configure JSTL support to Spring MVC application using maven build tool. Learn to enable JSTL tags in Spring MVC application.

1. JSTL maven dependencies



2. Configure InternalResourceViewResolver to resolve JSTL views

2.1. Spring JSTL Java Configuration

public ViewResolver configureViewResolver() 
	InternalResourceViewResolver viewResolve = new InternalResourceViewResolver();
	return viewResolve;

2.2. Spring JSTL XML Configuration

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
	<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
	<property name="prefix">
	<property name="suffix">

3. Use JSTL tags in JSP files

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

<h1>Welcome message : <c:out value="${message}"></c:out></h1>

Happy Learning !!

Read More:

JSTL Library

Was this post helpful?

Join 7000+ Awesome Developers

Get the latest updates from industry, awesome resources, blog updates and much more.

* We do not spam !!

7 thoughts on “Spring MVC JSTL Configuration Example”

  1. I’m a newbie in JavaEE, so can someone explain me this : if we use dependencies from Maven, why do we need the taglib with uri to indicate a lib in the web ? For me, it is like to ask Maven to retrieve and then, retrieve the same libs from a url.

    • The uri element in the TLD is a unique name for the tag library. It does NOT need to represent any actual location (path or URL). It simply has to be a name—the same name you use in the taglib directive. You can verify it in the network tab of browser tool. No request is made to given url.

      It is just way back in past, Sun microsystem thought to use a unique name in URL format. They could have used “xyz_abc” and even it would have worked absolutely fine.

  2. As a side note how to add JSTL support in Struts application built using maven – will adding the appropriate maven dependencies (as indicated in the article) be good enough?

  3. getting following error -in spring Application ,pl help

    java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
    at org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:97)
    at org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:135)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:211)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)

    • according to your problem there was two possibility for this particular error
      1. missing jstl but i hope you have this in dpendency
      2.not acorrect version of servlet less
      please try to change the servlet version in your project to



Leave a Comment


A blog about Java and related technologies, the best practices, algorithms, and interview questions.