JSP 中使用Struts标签出现的错误,解决办法
来源:互联网 发布:系统数据库设计 编辑:程序博客网 时间:2024/06/05 19:28
问题描述:
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Strut s 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中直接访问jsp
异常: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.
环境:struts2
原因:如果想要在jsp文件中,采用 struts的tag,那么jsp必须是通过action跳转得到,也就是必须通过web.xml所配置的过滤器访问文件,否则会有异常。
解决办法:
方案一:将web.xml 的过滤器,从 *.action 修改为: /* 。
方案二:web.xml 中添加一个filter
<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>
方案三:web.xml加入:
<jsp-config>
<taglib>
<taglib-uri>struts-tags</taglib-uri>
<taglib-location>/WEB-INF/struts2-core-2.0.11.jar/struts-2.0.dtd</taglib-location>
</taglib>
</jsp-config>
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Strut s 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中直接访问jsp
异常: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.
环境:struts2
原因:如果想要在jsp文件中,采用 struts的tag,那么jsp必须是通过action跳转得到,也就是必须通过web.xml所配置的过滤器访问文件,否则会有异常。
解决办法:
方案一:将web.xml 的过滤器,从 *.action 修改为: /* 。
方案二:web.xml 中添加一个filter
<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>
方案三:web.xml加入:
<jsp-config>
<taglib>
<taglib-uri>struts-tags</taglib-uri>
<taglib-location>/WEB-INF/struts2-core-2.0.11.jar/struts-2.0.dtd</taglib-location>
</taglib>
</jsp-config>
- JSP 中使用Struts标签出现的错误,解决办法
- 在jsp中使用struts表单标签时出现找不到路径的问题
- struts中使用this.addFieldError时出现错误解决办法
- MyEclipse中创建Struts出现错误的解决办法
- MyEclipse中创建Struts出现错误的解决办法
- 出现 JSP页面中使用JSTL标签无法解析 错误的原因及解决方法
- struts 2.1.8.1的sx:datetimepicker标签出现NaN错误的原因和解决办法
- struts 2.1.8.1的sx:datetimepicker标签出现NaN错误的原因和解决办法
- 在jsp中使用Struts标签
- 在使用STRUTS标签修改MYSQL里面的数据时出现错误
- Git使用中出现的错误以及解决办法积累
- jsp,servlet,struts等出现乱码的解决办法。
- 使用Create出现WSAEADDRINUSE错误的解决办法
- 使用github出现的错误以及解决办法
- 使用github出现的错误以及解决办法
- HTML中使用struts标签的方法
- struts中html:options标签的使用
- struts中ec标签的使用
- python版本mysql connctor使用问题一例:不能获取到新数据
- 在自己的电脑上搭建服务器,发布自己的网站(学习之用)
- Qt 智能指针学习
- apk签名:apk完整性 包名+(签名Key中的)公钥:覆盖安装 (密钥对全球唯一)
- IT群侠传之一
- JSP 中使用Struts标签出现的错误,解决办法
- 我的Android进阶之旅------>Android中Drawable分类汇总详解
- 【自己动手写数据结构】 -- 图的邻接表存储实现
- 简单易懂的SSDT学习心得
- IT群侠传之二
- 过程控制实验数据处理(1)
- 谈谈你对摩尔定律的理解。摩尔定律当前还是继续有效的吗?
- 拔智齿的经历
- uva 10026 Shoemaker's Problem