title: Why do I need a view class to resolve JSTL views in Spring MVC?
body: <p>I am going through Craig Walls <a href="https://www.manning.com/books/spring-in-action-fourth-edition" rel="nofollow noreferrer">Manning Spring4 in Action</a>.</p>
  
  <p>In Creating JSP views, he suggests,</p>
  
  <blockquote>
    <p>The InternalResourceViewResolver ultimately resolves logical view
    names into instances of InternalResourceView that reference JSP files.
    But if those JSP files are referencing JSTL tags for formatiing or
    messages, then you may want to configure InternalResourceViewResolver    to resolve a JSTLView instead.</p>
  </blockquote>
  
  <p>All that's needed to have InternalResourceView Resolver resolver JstlView instead of InternalResourceView is to set its viewClass property.</p>
  
  <p>like this,</p>
  
  <pre><code> @Bean
      public ViewResolver viewResolver() {
  
          InternalResourceViewResolver resolver =
              new InternalResourceViewResolver();
          resolver.setPrefix("/WEB-INF/views/");
          resolver.setSuffix(".jsp");
          resolver.setViewClass(org.springframework.web.servlet.view.JstlView.class);
  
          return resolver;
      }
  </code></pre>
  
  <p>Why do I need to add this line</p>
  
  <p><code>resolver.setViewClass(org.springframework.web.servlet.view.JstlView.class);</code></p>
  
  <p>and what exactly is this class meant for?</p>
  
  <p>Any suggestions?`</p>