The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the asso
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>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
折腾了好久,原来是因为控制器只处理了。action的访问,需要把.jsp也交给控制器处理才能正确使用struts标签。解决方法就是在web.xml加入以下配置:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
这样struts自带的验证就能正常显示了
还没有评论,来说两句吧...