0
点赞
收藏
分享

微信扫一扫

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

阎小妍 2023-05-11 阅读 57


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自带的验证就能正常显示了

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

举报

相关推荐

0 条评论