How to configure spring boot mvc app for JSP?

前端 未结 5 1845
遥遥无期
遥遥无期 2020-12-15 12:45

I am new to Spring boot ( and servlet 3.0 ). I am trying to create spring mvc project with JSP as view. When I return a view from my controller it is not getting resolved a

5条回答
  •  离开以前
    2020-12-15 13:20

    If we want to use jsp as view in spring boot(which by default has tomcat server) we need to add the following to our pom.xml:

    
            org.apache.tomcat.embed
            tomcat-embed-jasper
            provided
    
    

    we need to add our pages inside

    src/main/webapp/WEB-INF/view

    After this we can specify the location for our jsp pages in application.properties

      spring.mvc.view.prefix=/WEB-INF/view/
      spring.mvc.view.suffix=.jsp
    

提交回复
热议问题