首页 新闻 会员 周边

springboot 添加jsp支持 没有效果

0
[待解决问题]

pom.xml

 

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- jsp -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<!-- servlet 依赖 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<!-- 添加 JSTL 支持 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- tomcat的支持.-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
</dependencies>



application.properties

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

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

两个都试过了

启动类

@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}


@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoApplication.class);
}

}



访问页面

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Mar 28 18:14:42 CST 2018
There was an unexpected error (type=Not Found, status=404).
/WEB-INF/jsp/index.jsp
骑着毛驴追火车的主页 骑着毛驴追火车 | 菜鸟二级 | 园豆:202
提问于:2018-03-28 18:17
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册