使用 Struts 实现 Spring 安全性 2
Implementing Spring Security with Struts 2
我想实施 Spring 安全 + Struts2
我在执行我的项目时遇到了问题:
There is no Action mapped for namespace [/] and action name [j_spring_security_check] associated with context path [/Project]
because there is no action named 'j_spring_security_check' in struts.xml
我该如何解决这个问题?这是 Login.jsp
的代码
Login.jsp
<form action="/j_spring_security_check" method="POST">
<input type="text" placeholder="ID Utilisateur" name="j_username" autofocus>
<input type="password" placeholder="Mot de passe" name="j_password">
<button type="submit"><i class="fa fa-lock"></i> Se Connecter</button>
</form>
表单操作应在 struts 过滤器之前由 spring 安全处理。确保过滤器的顺序如下
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
我想实施 Spring 安全 + Struts2
我在执行我的项目时遇到了问题:
There is no Action mapped for namespace [/] and action name [j_spring_security_check] associated with context path [/Project] because there is no action named 'j_spring_security_check' in struts.xml
我该如何解决这个问题?这是 Login.jsp
Login.jsp
<form action="/j_spring_security_check" method="POST">
<input type="text" placeholder="ID Utilisateur" name="j_username" autofocus>
<input type="password" placeholder="Mot de passe" name="j_password">
<button type="submit"><i class="fa fa-lock"></i> Se Connecter</button>
</form>
表单操作应在 struts 过滤器之前由 spring 安全处理。确保过滤器的顺序如下
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>