代码改变世界

The Struts dispatcher cannot be found. This is usually caused by using Strut

2013-11-10 13:44  合翅  阅读(879)  评论(0编辑  收藏  举报

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]

解决方案:

如果你是*.do或者*.action 的方式创建的项目,那你要这样错处理才不会出错误,当然这只是其中的一种方式:
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>*.action</url-pattern>
  </filter-mapping>
  <!-- 记住加入这个配置,不然在使用struts-tag标签会报错误 -->
  <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
  </filter-mapping>
也就是在web.xml中为struts2的的filter-mapping添加一个,把jsp放行,不拦截jsp