日期:2014-05-20  浏览次数:20744 次

web配置
刚网上随便下了个web项目放到webapp里了
结果访问工程文件夹下index.jsp 结果404
试了试发现只要有WEB-INF就出404
web.xml内容 把里面.class都删了也不行 才学jsp,求被前辈指导
XML code

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
    <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>
    
    <taglib>
        <taglib-uri>struts2</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-tags.tld</taglib-location>
    </taglib>
</web-app>




------解决方案--------------------
访问路径发下 路劲错了~
------解决方案--------------------
Java code

 <taglib>
        <taglib-uri>struts2</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-tags.tld</taglib-location>
    </taglib>
是来干嘛的?strust2不需要配置这个

------解决方案--------------------
干嘛把taglib配到web.xml里?
404一般是你的路径有问题
------解决方案--------------------
404是路径不存在

在配置文件中加上这个

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