java 无法使用 Tomcat 服务器从 IntelliJ 中运行/调试 jsp 页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28346328/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot run/debug jsp page from within IntelliJ using Tomcat server
提问by Angelina
I created a new project and created artifact for it.
When I run Tomcat from command prompt and go to: http://localhost:8080/IntelProject1/index.jsp
我创建了一个新项目并为其创建了工件。当我从命令提示符运行 Tomcat 并转到:http://localhost:8080/IntelProject1/index.jsp
I can see my page.
我可以看到我的页面。
But when I try to run it from IntelliJ, it opens empty page: http://localhost:8080
但是当我尝试从 IntelliJ 运行它时,它打开了一个空页面: http://localhost:8080
and if I try to go to:
http://localhost:8080/IntelProject1/index.jsp
如果我尝试去:
http://localhost:8080/IntelProject1/index.jsp
this is what it displays:
这是它显示的内容:
HTTP Status 404 - /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
The reason it is able to find it from tomcat is because I edited server.xml file in tomcat/conf folder:
之所以能够从 tomcat 中找到它,是因为我在 tomcat/conf 文件夹中编辑了 server.xml 文件:
<Context path="/IntelProject1" docBase="C:\Users\ibogojevic\Desktop\IntelProject1\web\JSP" />
But I want to be able to open it and debug from within IntelliJ
但我希望能够打开它并从内部调试 IntelliJ
Maybe my artifact is wrong. Any thoughts?
也许我的神器是错误的。有什么想法吗?
回答by proactive-e
Open Debug Configurationin IntelliJ IDEA and make sure that Deploy applications configured in Tomcatcheckbox is checked as it shown on the screenshot.
在 IntelliJ IDEA 中打开调试配置,并确保在 Tomcat 中配置的部署应用程序复选框被选中,如屏幕截图所示。
回答by Suisse
For me it worked with:
对我来说,它适用于:
File >Project Structure >Artifacts
文件 > 项目结构 > 工件
In the
在里面
Output Layout on the right side >"Available Elements?"
右侧的输出布局>“可用元素?”
right click on the available libraries( for me it was "Spring MVC-4.2.4.RELEASE")
右键单击可用的库(对我来说是“Spring MVC-4.2.4.RELEASE”)
Put into Lib
放入库
And it worked.
它奏效了。