struts2标签出错:The Struts dispatcher cannot be found...[unknown location]
我在使用struts2标签(<s:debug></s:debug>)时报以下错误:
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]
原因:在index.jsp中我直接使用了struts2标签。在访问应用程序的时候直接访问index.jsp(并未经过action的转发);而在web.xml配置文件中配置struts2的默认拦截器拦截后缀名为.action的应用。
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-app>
方法2:添加一个action,通过这个action转发访问index.jsp