IDEA的springboot集成jsp找不到页面的解决方式
1.方式一:IDEA配置
步骤一:点击edit configurations…

步骤2:点击Environment

步骤3:点击working directory 选择第三个,然后点击apply,ok就能访问jsp页面

2.方式二:添加一个配置文件
@Configuration
public class GlobalConfig {
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> customizer() {
return (factory) -> {
factory.addContextCustomizers((context) -> {
//模块中webapp相对路径
String relativePath = "tt-web/src/main/webapp";
File docBaseFile = new File(relativePath);
// 路径是否存在
if (docBaseFile.exists()) {
context.setDocBase(docBaseFile.getAbsolutePath());
}
}
);
};
}
}
IDEA集成SpringBoot与JSP
本文介绍了解决IDEA环境下SpringBoot项目集成JSP页面时遇到的问题,提供了两种有效的方法:一是通过IDEA配置调整,二是添加自定义配置文件实现页面的正确加载。
3017

被折叠的 条评论
为什么被折叠?



