ssm框架整合时遇到的问题
2016-10-20 15:13
441 查看
这是我在整合struts2,mybatis,spring时遇到的一些问题,在此分享出来,并记录下来供参考.
第一个问题和解决方式:
The Struts dispatcher cannot be found. This is usually caused by using
Struts tags without the associated filter. 异常
异常信息: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.
-----这是由于添加了struts的标签后引起的
在web.xml的配置<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>
默认是*.action过滤
引入struts标签后,出现这种异常,归纳以下有三种解决方法:
1:将web.xml下struts过滤器的过滤方式*.action改为/*;这样会默认对所有的进行过滤,自我感觉不是很好.
2:在页面不使用struts标签.
3:再加一个过滤方式
<filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping>
推荐使用第三个方式!!!
相关文章推荐
- SSM(Spring+SpringMVC+MyBatis)三大框架整合及遇到的各种问题
- SSM框架整合遇到的问题
- SSM框架整合遇到的问题汇总(Spring+SpringMVC+Mybatis+PostgreSQL+Tomcat7+Maven)v.18
- ssm框架整合遇到的问题
- ssm框架整合遇到的问题
- maven配置SSM框架整合 其中包括maven在使用过程中遇到的问题
- SSM框架整合遇到的问题
- SSM框架整合中遇到的问题汇总
- java idea+ssm框架遇到的问题
- maven开发ssm框架所遇到的问题:
- 整合三个框架遇到问题以及解决办法
- js+ssm框架整合的一些问题
- 使用maven搭建ssm框架遇到的spring找不到配置文件问题
- maven整合ssm遇到的小问题2
- idea在搭建ssm框架时mybatis整合问题 无法找到mapper
- 使用ssm框架的java项目由mysql转oracle遇到问题
- ssm框架的搭建与期间遇到的问题
- 005商城项目:ssm框架的整合成功之后的问题:使用maven的tomcat插件时的debug
- ssh三大框架整合时struts2遇到的简单又很容易忽视的问题
- 关于SSM整合中遇到的org.springframework.beans.factory.BeanDefinitionStoreException: IOException pars 问题