无法使用 Tomcat 服务器从 IntelliJ 中 run/debug jsp 页面

Cannot run/debug jsp page from within IntelliJ using Tomcat server

我创建了一个新项目并为其创建了工件。 当我从命令提示符 运行 Tomcat 转到:http://localhost:8080/IntelProject1/index.jsp

我可以看到我的页面。

但是当我尝试从 IntelliJ 运行 它时,它会打开空白页面: http://localhost:8080

如果我尝试去: http://localhost:8080/IntelProject1/index.jsp

这是它显示的内容:

HTTP Status 404 - /IntelProject1/index.jsp

type Status report

message /IntelProject1/index.jsp

description The requested resource is not available.

Apache Tomcat/7.0.57

它能够从 tomcat 中找到它的原因是因为我编辑了 tomcat/conf 文件夹中的 server.xml 文件:

<Context path="/IntelProject1" docBase="C:\Users\ibogojevic\Desktop\IntelProject1\web\JSP" />

但我希望能够打开它并从内部进行调试 IntelliJ

也许我的神器是错误的。 有什么想法吗?

在 IntelliJ IDEA 中打开 Debug Configuration 并确保选中 Deploy applications configured in Tomcat 复选框,如图所示在屏幕截图上。

对我来说,它适用于:

File >Project Structure >Artifacts

Output Layout on the right side >"Available Elements?"

右键单击可用库(对我来说是"Spring MVC-4.2.4.RELEASE")

Put into Lib

它奏效了。