tomcat服务器上的Intellij Web应用程序显示http:// localhost:8080 / index.jsp而不是http:// localhost:8080 / myapp / index.jsp

时间:2015-06-21 09:56:39

标签: java jsp tomcat servlets intellij-idea

我正在关注udemy的教程。在教程中他使用的是eclipse。但我跟随intellij学习了这门课程。每件事都运行正常但我注意到的一件事是,当他运行servlet或jsp页面时,它总是在servlet(http://localhost:8080/myapp/index.jsp)之前显示项目名称。 但是当我在intellij上创建一个Web应用程序时,它只显示http://localhost:8080/index.jsp

所以问题是如何在/index.jsp之前获取项目名称。

我尝试将此添加到web.xml文件中,但似乎无法正常工作

int smallest = numbers.stream().min((n1, n2) -> Integer.compare(n1, n2)).get();

1 个答案:

答案 0 :(得分:4)

您可以在tomcat服务器的“编辑配置”中输入您的应用程序URL。

  • 点击编辑配置
  • 在启动页面中输入您的应用程序URL

enter image description here

注意: - 上面的解决方案很可能会有效,如果没有,那么您可能需要在部署选项卡中将应用程序上下文更改为“\ myApp”。

相关问题