繁体   English   中英

运行我的应用程序时如何默认调用index.jsp

[英]how to call index.jsp as default when Run my application

我创建了一个Web动态项目,并在WebContent文件夹下创建了一个文件夹作为视图名称。 我将index.jsp文件保留在视图文件夹中。

我想要这样做,以便在运行应用程序时默认情况下将显示索引页面。 将其保留在webcontent文件夹中时会工作,但是当我将其放入view文件夹中时会收到错误消息(页面不可用)

如何在Eclipse中解决此问题?

都很简单,您可以通过添加以下标记在web.xml文件中对其进行配置

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>name you want to see</display-name>
  <welcome-file-list>
    <welcome-file>view/yourFile.jsp</welcome-file>
  </welcome-file-list>
</web-app>

并且它将在运行您的应用程序时作为首页加载

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM