您的位置:首页 > 编程语言 > Java开发

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

2016-04-27 14:17 906 查看
异常信息如下:

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]


解决办法:

struts2的标签已经引入了,查询后归纳了以下几种方法:
1.将web.xml下的struts2过滤器的过滤方式从.action改为/*;不过这种方式自己感觉不太好,应该这样默认就将所有的进行了过滤,可能会对有些应用带来麻烦,例如:fck的配置

2. 修改Test.jsp 文件,不使用 struts 的标签

3.就是在web.xml配置文件中再添加一个filter:

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: