当前位置:编程学习 > JAVA >>

帮忙看下struts2的一个错误

使用struts2标签时出的错误。
错误信息是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.FilterDispatcher</filter-class>

</filter>

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

网上查了下说加一个过滤选项
         <filter-mapping>
             <filter-name>struts2<filter-name>
             <url-pattern>*.jsp<url-pattern>
          <filter-mapping>
可是一加*.jspeclipse就报错,说什么jsp is not well spelled的
到底该怎么解决? --------------------编程问答-------------------- 1、
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
换成 
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>

2、
jsp头部加<%@ taglib prefix="s" uri="/struts-tags" %>

3、
再就是看看是不是少什么包了。
补充:Java ,  Java SE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,