SpringBoot cannot provide jsp files in webapp Folder

I am new in springboot trying to simple webapp.

Using springboot 2.1.0 application.properties file like below. I have jsp files in src/main/webapp/WEB-INF/jsp


My controller is .

class WelcomeController {
    fun showWelcomePage(model: Model): String {
      model["name"] = "asdas"
      return "welcome"

When I put jsp files in /main/resources/META-INF/resources/WEB-INF/jsp it works otherwise got below error

There was an unexpected error (type=Not Found, status=404).

Also pom has tomcat-embed-jasper dependency


Any idea?

2 answers

  • answered 2018-11-08 08:55 곽대용

    are you using intellij? i had experience about same spring boot (jsp view) project is working in eclipse, but it's not work in intellij. i requested to jetbrain about this issue, they are say to me that "it's right, but we recomment use template engine like handlebars"

  • answered 2018-11-08 09:25 Alien

    Ensure that jasper dependency and embedded tomcat dependency versions should be same otherwise it will be an issue.

    Also try putting a jsp page outside itself like src/main/webapp/abc.jsp and remove view resolver and return directly like "abc.jsp" and see if that works.

    see this at 7:30