集成Struts 2和Spring Security时出错

时间:2012-12-24 08:59:55

标签: struts2 spring-security

我正在尝试用struts实现一个简单的弹簧安全2你好世界一切看起来都很好但是一直没有找到错误动作但我知道我发布我的代码在这里指导我,如果有任何错误。

Web.xml文件

<context-param> 
        <param-name>contextConfigLocation</param-name> 
        <param-value> /WEB-INF/spring-security.xml </param-value> 
    </context-param> 

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>
                  org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter> 
        <filter-name>struts2</filter-name> 
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 
    </filter>

    <listener> 
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener>

    <filter-mapping> 
        <filter-name>struts2</filter-name> 
        <url-pattern>/*</url-pattern> 
    </filter-mapping>

spring-security.xml

<http auto-config="true">
    <intercept-url pattern="/helloWorld*" access="ROLE_USER" />
</http>

<authentication-manager>
  <authentication-provider>
    <user-service>
    <user name="chetan" password="123456" authorities="ROLE_USER" />
    </user-service>
  </authentication-provider>
</authentication-manager>

Struts.xml文件

<struts>  
 <constant name="struts.action.excludePattern" value="/j_spring_security_check"/>  
 <constant name="struts.action.excludePattern" value="/j_spring_security_check.*,.*\\.j_spring_security_check"/>  

  <package name="default" namespace="/" extends="struts-default">  
     <action name="helloWorld" class="com.hello.HelloWorld">  
       <result name="SUCCESS">/WEB-INF/successfull.jsp</result>  
     </action>
  </package>  
 </struts>

我得到的错误就是这个

  Caused by: Action class [com.hello.HelloWorld] not found - action

0 个答案:

没有答案