1.在jsp页面上直接使用struts2的s标签,要求必须经过FileterDispatcher过滤,否则总会报错
org.apache.jasper.JasperException: 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.
解决办法:
org.apache.jasper.JasperException: 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.
解决办法:
- <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>*.action</url-pattern><!--过滤主要操作--> //action中用到
- </filter-mapping>
- <filter-mapping>
- <filter-name>struts2</filter-name> //jsp页面中,struts2标签需要用到
- <url-pattern>*.jsp</url-pattern>
- <!--因为若在jsp页面使用struts标签,就必须经过FilterDispacher的过滤,这样配置便可保证所有的jsp都经过FilterDispatcher了,否则要为每一个jsp写配置一个action地址转入-->
- </filter-mapping>
本文介绍了如何在JSP页面中正确使用Struts2的s标签。为了使s标签正常工作,需要确保请求通过Struts2的FilterDispatcher过滤。文中详细展示了在web.xml中配置FilterDispatcher的具体步骤。

7915

被折叠的 条评论
为什么被折叠?



