我在myeclipse5.5上开发程序,把tomcat嵌入到myeclipse中了,建了一个web project,然后启动tomcat,在IE中输入网址,为什么进入的页面是Directory Listing For /   而不是直接就是我的首页,只有进入WebRoot/中才看到我的首页,并且我在web.xml中配置<welcome-file></welcome-file>后,进入WebRoot/看到的不是我期望的首页,求助,多谢了

解决方案 »

  1.   

    打开conf\web.xml文件. 
    修改<servlet> 
    <servlet-name>default<rvlet-name> 
    <servlet-class>org.apache.catalina.servlets.DefaultServlet<rvlet-class> 
    <init-param> 
    <param-name>debug</param-name> 
    <param-value>0</param-value> 
    </init-param> 
    <init-param> 
    <param-name>listings</param-name> 
    <param-value>false</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
    </srvlet> listings的值 
    true 默认值,显示目录下的文件并列表 
    false 不显示目录下的文件
      

  2.   


    为什么还是显示呢?
    第二个问题呢?
    怎么感觉我配置了web.xml文件不管用呢?已经重启服务器了
      

  3.   

    在你的工程下的web.xml里加入这个    
    <welcome-file-list>
            <welcome-file>your project name/index.jsp</welcome-file>
            
        </welcome-file-list>把conf/web.xml里的
    <param-name>listings </param-name> 
    <param-value>false </param-value> 
    listings的值 
    true 默认值,显示目录下的文件并列表 
    false 不显示目录下的文件
      

  4.   


    我已经配置好了,但是这次不显示目录列表了,显示TTP Status 404 - /sue/ (sue是我的工程名),在后面加上/WebRoot后就能显示index,但是不是我是指的欢迎界面
      

  5.   

    正常情况下在
    在你的工程下的web.xml里加入这个    
    <welcome-file-list> 
            <welcome-file>your project name/index.jsp </welcome-file> 
            
        </welcome-file-list> 
    将index.jsp改为你所要显示的页面就可以了。
      

  6.   

    给你个例子吧.假如我的项目名称是test,并且部署到tomcat下面的名称也是test.
    我想直接输入http://localhost:8080/test 就得进入我想要的主页.
    假如首页名称问test.jsp那就在在web.xml这样配置
    <welcome-file-list> 
            <welcome-file>test.jsp</welcome-file>         
    </welcome-file-list> 
    提醒一下:
    注意用Myeclipse部署的时候文件名