Eclipse动态Web项目-默认开始页面 [英] eclipse dynamic web project - default start page

查看:165
本文介绍了Eclipse动态Web项目-默认开始页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse动态Web项目中创建,在WEB-INF文件夹中有index.html。我单击项目的主文件夹,运行方式>在服务器上运行,选择Tomcat v7.0,完成,它运行正常。但是,当我将index.html重命名为另一个名称时,会得到以下消息:

I created in Eclipse dynamic web project, I have index.html in WEB-INF folder. I click on the main folder of the project Run as > Run on server chose Tomcat v7.0, finish, and it runs OK. But, when I rename index.html to another name I get the message:


所请求的资源(/ MyProject /)不可用。

The requested resource (/MyProject/) is not available.




  1. 如何更改默认页面?

  2. 可以我把默认页面的asp文件放进去了吗?

我的web.xml是:

My web.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>MyFirstServlet</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description>new</description>
    <display-name>GrettingServlet</display-name>
    <servlet-name>GrettingServlet</servlet-name>
    <servlet-class>GrettingServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>GrettingServlet</servlet-name>
    <url-pattern>/GrettingServlet</url-pattern>
  </servlet-mapping>
</web-app>


推荐答案

在web.xml中(在TOMCAT_HOME / webapps / you_application下) ),您可以这样:

In web.xml (under TOMCAT_HOME/webapps/you_application) you have this:

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

更改为新文件名

这篇关于Eclipse动态Web项目-默认开始页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆