首页 文章

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

提问于
浏览
1

我'm following a tutorial on udemy. In the tutorial he is using eclipse. But i'跟随intellij的课程 . 每件事都运行正常但我注意到的一件事是,当他运行servlet或jsp页面时,它总是在servlet之前显示项目名称(http://localhost:8080/myapp/index.jsp) . 但是当我在intellij上创建一个Web应用程序时,它只显示http://localhost:8080/index.jsp .

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

我试图将此添加到web.xml文件,但它似乎不起作用

<display-name>myApp</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

1 回答

  • 4

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

    • 单击“编辑配置”

    • 在启动页面中输入您的应用程序URL

    enter image description here

    注意: - 大多数可能上面的解决方案都可以工作,如果没有,那么您可能需要在部署选项卡中将应用程序上下文更改为“\ myApp” .

相关问题