I created a simple Spring Boot web application in intelliJ. I put a simple .jsp file in the / src / main / resources / templates / folder, which contains the basic HTML code.
I try to return this in the controller, but I get this error;
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Sep 09 10:37:46 BST 2016
There was an unexpected error (type=Not Found, status=404).
No message available
I assume Spring cannot find the .jsp file, but there were no other errors in the console that could give me more information.
Here is my simple controller;
@Controller
@RequestMapping("/test")
public class TestController {
@RequestMapping("")
public ModelAndView index() {
return new ModelAndView("test");
}
}
I included the following in my application.properties file:
spring.mvc.view.prefix = /templates/
spring.mvc.view.suffix = .jsp
My POM file includes the following dependencies;
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
I am using Spring Boot with a built-in cat.
I tried changing the path to the views inside application.properties; classpath: / templates /, but that also didn't make any difference.
Finally, here is the structure of my project;

"" IntelliJ.