读书人

web配置,该怎么解决

发布时间: 2012-03-02 14:40:29 作者: rapoo

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>

读书人网 >J2SE开发

热点推荐