异常信息如下:
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:
1 <filter-mapping> 2 <filter-name>struts2</filter-name> 3 <url-pattern>*.jsp</url-pattern> 4 </filter-mapping> 5 <filter-mapping> 6 <filter-name>struts2</filter-name> 7 <url-pattern>*.action</url-pattern> 8 </filter-mapping>