struts2一遇到标签就出错,怎么回事?

来源:百度知道 编辑:UC知道 时间:2024/06/08 01:58:46
我编写JSP程序,但是一遇到struts2就开始了
HTTP Status 500 -
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

root cause

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter.

我的web.xml:
<fliter>
<fliter-name>struts2</fliter-name>
<fliter-class>org.apache.struts2.dispatcher.FliterDispatcher</fliter-class>
</fliter>
<filter-mapping>
<filter-name>struts2

你的情况是由于struts2的标签错误
首先确保在开头有
<%@ taglib prefix="s" uri="/struts-tags" %>
其次保证必要的jar包的导入
最后保证不要重复导入jar包
也就是先删除lib下的所有jar包
然后再重新导入

在jsp文件的头部要加上<%@ taglib prefix="s" uri="/struts-tags" %>

同时确保必要的jar文件存在

直接打开带有struts标签的JSP页面了?
通过一个action的空方法forward到这个页面就OK了

<url-pattern>/*</url-pattern>
这里既然配置了匹配所有的类型,以.jsp结尾的文件也是通过FliterDispatcher转发的,所以不是这个方面的问题