title: Classpath locations for jsp files in a Spring Boot Jar
body: <p>I'm trying to write a Spring Boot Application that is capable of using ModelAndView to send out JSP files back to the caller.</p>
  <p>Here is a Controller Method:</p>
  <pre><code>@Controller
  public class ExampleController
  {
      @GetMapping(&quot;/login&quot;)
      public ModelAndView getAuthPage(@RequestParam Map&lt;String, String&gt; params)
      {
          System.out.println(&quot;In Login mapping!&quot;);
  
          ModelAndView view = new ModelAndView();
          view.setViewName(&quot;login&quot;);
  
          ModelMap models = view.getModelMap();
          models.addAttribute(&quot;message&quot;, &quot;Log In&quot;);
  
          System.out.println(&quot;Returning View!&quot;);
          return view;
      }
  }
  </code></pre>
  <p>I'm able to get that Method to Return.</p>
  <p>Here are three of the fields in application.properties</p>
  <pre><code>spring.mvc.view.prefix=/templates/
  spring.mvc.view.suffix=.jsp
  spring.thymeleaf.enabled=false
  </code></pre>
  <p>Here is a list of some of the places I've attempted to store the login.jsp file:</p>
  <pre><code>src/main/resources/templates (only place where I could see them in the jar file)
  src/webapp
  src/webapp/WEB-INF/views
  </code></pre>
  <p>Looking at some of the --debug output and this <a href="https://stackoverflow.com/questions/5013917/can-i-serve-jsps-from-inside-a-jar-in-lib-or-is-there-a-workaround">Stack Overflow Question</a>, the App seems to be looking in a folder called <em>META-INF/resources</em> . While there is a <em>META-INF</em> folder in the Jar, there is no <em>META-INF/resources</em> folder.</p>
  <p>If the app is looking for <em>.jar/META-INF/resources.login.jsp</em> , is there a way, using Gradle, to ensure those jsp files are there. Otherwise, is there a way to have the app look for those JSP files in the <em>.jar/BOOT-INF/classes/templates/</em> which is where I currently am able to get those JSP files to in the JAR?</p>
  <p>Right now, I just want the file to be detected (within the JAR) when the controller method returns so that my client doesn't get a <strong>404 Not Found</strong></p>
  <p>Note: I am aware of <a href="https://stackoverflow.com/questions/43811840/spring-boot-jsp-views-not-found">this question</a> but the solution presented is to create a war instead of a jar and as of right now, I see that as a last resort type of solution.</p>