两个问题
一、启动的时候怎么报这样的错
2010-9-25 10:45:28 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/apache-tomcat-6.0.26/webapps/s2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72二、
用struts2的令牌机制,JSP里面加入 <s:token></s:token>
为什么提示这样的错?
严重: Servlet.service() for servlet jsp threw exception
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]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
这是什么意思?
包已经都是全的,没有落下
一、启动的时候怎么报这样的错
2010-9-25 10:45:28 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/apache-tomcat-6.0.26/webapps/s2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72二、
用struts2的令牌机制,JSP里面加入 <s:token></s:token>
为什么提示这样的错?
严重: Servlet.service() for servlet jsp threw exception
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]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
这是什么意思?
包已经都是全的,没有落下
你的应用的web.xml没有定义FilterDispatcher
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>org.apache.struts2.showcase.person</param-value>
</init-param>
</filter>
还是提示这个
严重: Servlet.service() for servlet jsp threw exception
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]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
还是不行
<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>
<package name="test" extends="struts-default" namespace="/test" >
<interceptors> <!-- 拦截器 -->
<interceptor name="test" class="com.david.inteceptor.Inte">
<param name="excludeMethods">test</param>
<!-- <param name="includeMethods">test1,test2</param> -->
</interceptor>
</interceptors>
<global-results>
<result name="suc">/suc.jsp</result>
<result name="login">/login.jsp</result>
<result name="global-exception">/error.jsp</result>
</global-results> <global-exception-mappings>
<exception-mapping result="global-exception" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
<action name="*_*" class="com.david.test.{1}Action" method="{2}">
<result name="loginsuc" >/loginsuc.jsp</result>
<interceptor-ref name="test"></interceptor-ref>
<interceptor-ref name="token"></interceptor-ref>
<result name="invalid.token">/wait.jsp</result>
<interceptor-ref name="token"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<!--
<result name="wait">/wait.jsp</result>
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="execAndWait"></interceptor-ref>
-->
</action>
</package>
<package name="test1" extends="struts-default" namespace="/fuck" >
<action name="*_*" class="com.david.test.{1}Action" method="{2}">
<result name="aa" >/aa.jsp</result>
</action>
</package>
<package name="test2" extends="test" namespace="/fuck" >
<action name="*_*" class="com.david.test.{1}Action" method="{2}">
<result name="aa" >/aa.jsp</result>
</action>
</package>
</struts>
第二个问题:含有struts标签的jsp页面,不能直接请求,必须经过struts2过滤器。楼主可统一通过action跳转到页面。或者在web.xml中,配置struts2的响应所有请求<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>/*</url-pattern>
</filter-mapping>