首页
/
每日頭條
/
生活
/
idea安裝本地springboot
idea安裝本地springboot
更新时间:2025-12-31 18:42:54
IDEA的springboot集成jsp找不到頁面的解決方式
  • 1.方式一:IDEA配置
  • 步驟一:點擊edit configurations...步驟2:點擊Environment步驟3:點擊working directory 選擇第三個,然後點擊apply,ok就能訪問jsp頁面
  • 2.方式二:添加一個配置文件
1.方式一:IDEA配置步驟一:點擊edit configurations…

idea安裝本地springboot(IDEA的springboot集成jsp找不到頁面的解決方式)1

步驟2:點擊Environment

idea安裝本地springboot(IDEA的springboot集成jsp找不到頁面的解決方式)2

步驟3:點擊working directory 選擇第三個,然後點擊apply,ok就能訪問jsp頁面

idea安裝本地springboot(IDEA的springboot集成jsp找不到頁面的解決方式)3

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()); } } ); }; } }

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2025 - www.tftnews.com All Rights Reserved