struts2错误:The Struts dispatcher cannot be found.
2014-04-28 14:12
471 查看
我在一个jsp页面中引入了另外一个jsp页面。这是引入jsp页面的部分报出的错误。
经过查找资料有下面几种可能。
1,
用了struts标签,但没有引入标签?
JSP页面中没有加入类似下面内容:
<%@ taglib prefix="s" uri="/struts-tags"%>
如果加上了上面的内容,所以可以试试第二种方法。我试过第二和第三种方法,都是可以的。
那么有人问,第二和第三种方法的却别在哪里呢?区别就在拦截器上,第二种方法是对所有请求都不进行拦截;
第三种方法是只放过.action和jsp请求,对其他的请求进行拦截。
第三种方法中如果没有加上.jsp,那么所有页面的引入jsp将不能成功。
2,
也有可能是配置问题
web.xml中配置的struts2 filter拦截器不是/*
应该配置成:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3,
解决办法:加了标签后,出现此问题
其实最后只在原配置基础上加上.jsp过滤即可
<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>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
相关文章推荐
- struts2错误:The Struts dispatcher cannot be found.
- struts2错误:The Struts dispatcher cannot be found.
- Struts2错误:The Struts dispatcher cannot be found.
- struts2错误:The Struts dispatcher cannot be found.
- struts2错误:The Struts dispatcher cannot be found.
- Struts2配置错误之The Struts dispatcher cannot be found
- struts2错误:The Struts dispatcher cannot be found
- struts2错误:The Struts dispatcher cannot be found.
- struts标签错误The Struts dispatcher cannot be found.
- struts2标签 The Struts dispatcher cannot be found
- The Struts dispatcher cannot be found在struts2中出现的问题
- Struts2-The Struts dispatcher cannot be found
- The Struts dispatcher cannot be found在struts2中出现的问题
- struts2 The Struts dispatcher cannot be found异常解决办法
- struts标签错误The Struts dispatcher cannot be found.
- the Struts dispatcher cannot be found. 在struts2中出现的问题
- struts2报错The Struts dispatcher cannot be found
- 解决struts2中UI标签出现的问题: The Struts dispatcher cannot be found
- The Struts dispatcher cannot be found在struts2中出现的问题
- The Struts dispatcher cannot be found. 在页面使用struts2的标签时报的异常