日期:2014-05-17  浏览次数:20691 次

HTTP Status 404怎么解决?
这个示例的web.xml太简单了,完全和网上的对不上号啊……

XML code
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <!-- 配置Spring -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            WEB-INF/classes/com/us/jack/config/applicationContext.xml
            WEB-INF/classes/com/us/jack/config/applicationContext-services.xml
        </param-value>
    </context-param>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
 
  
    <!-- 配置Struts2 -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>


求各位帮忙了。另外这个示例的index.jsp文件有两个,分别属于user文件夹和sbook文件夹。这样做没问题吗?

------解决方案--------------------
你得指定是哪个文件夹下的index吧 貌似?
------解决方案--------------------
将index.jsp放在应用程序根目录下。
或者:
如果user文件夹放在应用程序根目录下,则
<welcome-file-list>
<welcome-file>/user/index.jsp</welcome-file>
</welcome-file-list>
如果user文件夹放在应用程序的web-inf目录下,则

<welcome-file-list>
<welcome-file>/WEB-INF/user/index.jsp</welcome-file>
</welcome-file-list>

------解决方案--------------------
呵呵,像楼主的配置文件,index.jsp前面什么路径都没有,默认指向的是WebContent文件下的index.jsp文件
------解决方案--------------------
将index.jsp放在应用程序根目录下。
或者:
如果user文件夹放在应用程序根目录下,则
<welcome-file-list>
<welcome-file>/user/index.jsp</welcome-file>
</welcome-file-list>
如果sbook文件夹放在应用程序的web-inf目录下,则

<welcome-file-list>
<welcome-file>/sbook/index.jsp</welcome-file>
</welcome-file-list>