jsp报The Struts dispatcher cannot be found. This is usually caused by using Struts tags without

来源:互联网 发布:域名如何绑定服务器ip 编辑:程序博客网 时间:2024/06/10 15:51

学习struts2时候,在jsp中使用到<s:fielderror/>回显错误信息报


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]

,上网查找发现错误的产生是配置web.xml的问题

原配置:

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>

修改为:

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

就可以了

原创粉丝点击