【问题标题】:Creating a dynamic web project with maven in eclipse and running it on server在eclipse中用maven创建动态web项目并在服务器上运行
【发布时间】:2017-02-03 11:27:08
【问题描述】:

当我在 Eclipse 和 Tomcat 服务器中使用 maven 创建一个动态 Web 项目时,它显示“Hello World”。我的问题在 index.jsp 文件中说“hello World”,但我找不到它被添加到“web.xml”文件中。 如果不将其添加到 web.xml,它是如何工作的? 提前致谢。

【问题讨论】:

  • 这就是 JSP 的工作方式。

标签: java


【解决方案1】:

Tomcat 在 $TOMCAT_HOME/conf 中有其默认的“web.xml”,如果在您的项目“web.xml”中找不到映射,它将搜索默认的映射。

看看那个文件,你会发现:

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    <url-pattern>*.jspx</url-pattern>
</servlet-mapping>

它还有一个默认的欢迎文件列表:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

【讨论】:

    猜你喜欢
    • 2014-10-07
    • 2014-07-03
    • 2014-03-04
    • 1970-01-01
    • 2012-07-28
    • 2011-06-02
    • 2016-02-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多