如何从IntellijIDEA部署tomcat/webapps文件夹 [英] How to deploy tomcat/webapps folder from IntellijIDEA
问题描述
我正在通过Intellij IDEA Tomcat集成测试Web应用程序(基于Apache Wicket).在那里,我注意到webapp认为它在tomcat的bin文件夹中运行.同样,当我调用 ServletContext.getContext("/")
时,它会返回 null
.但是,当我在tomcat中手动部署相同的webapp时,效果很好.如何在Intellij IDEA中解决此问题?
I am testing a web application (Apache Wicket Based) via Intellij IDEA Tomcat integration. There I noticed that the webapp consider its running in bin folder of the tomcat. Also when I called the ServletContext.getContext("/")
it returns null
. But when I deploy the same webapp manually in tomcat it works fine. How can solve this in Intellij IDEA?
推荐答案
在IntelliJ(我正在使用Ultimate 2017)中,上下文目录是通过文件">项目结构"设置的.在"Web资源目录"列表下,默认情况下,IntelliJ填写了以/webapp
结尾的路径,该路径不存在并且显示为红色.我将其更改为包含根级别 index.jsp
的文件夹.重建后,我的JSP正在呈现,并且CSS和JS(与JSP存储在同一棵树中)已完美加载.
In IntelliJ (I'm using Ultimate 2017), the context directory is set through File > Project Structure. Under the Web Resource Directories list, IntelliJ had filled in a path ending with /webapp
by default, which didn't exist and was in red. I changed that to the folder enclosing my root-level index.jsp
. After a rebuild, my JSPs were rendering and the CSS and JS (stored in the same tree as the JSPs) were loading perfectly.
这篇关于如何从IntellijIDEA部署tomcat/webapps文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!