返回信息流最近才学java web,用到了struts2,按照教程上的配置方法配置好了以后,却出现error404,还望各位大神指导,不胜感激!
web.xml文档如下
<?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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>ch13</display-name>
<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.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>
</web-app>
现在我出现的问题是如果在web.xml文档中加上filter后就会出现404错误,看了网上的好多方法,试了一下还是没有成功。。。
这是一条镜像帖。来源:北邮人论坛 / java / #19658同步于 2011/8/8
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
求问在使用struts2时出现页面无法显示
Divingpig
2011/8/8镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
【 在 he1l0 的大作中提到: 】
: 我猜是filter用的class不在classpath里或者必要的jar没考到对的folder里
: --
问题已经解决了,是因为我用的是最新版本的struts2.2.3 在最新版本中必须添加commons-fileupload、
commons-iocommons-lang、commons-logging、freemarker、javassist、ognl、struts2-core、xwork-core等jar包。再添加完毕后,我又发现在tomcat中存在同名而不同版本的jar包,导致jar载入失败,删除完毕后成功显示了。 谢谢你啦~~
在启动Tomcat时,console里会有信息提示
struts2启动不了一般都会在这时候报错。
【 在 Divingpig 的大作中提到: 】
: : 我猜是filter用的class不在classpath里或者必要的jar没考到对的folder里
: : --
: 问题已经解决了,是因为我用的是最新版本的struts2.2.3 在最新版本中必须添加commons-fileupload、
: ...................