Hibernate 如何通过AuthenticationFailureHandler显示Spring3和RichFaces的登录问题?

Hibernate 如何通过AuthenticationFailureHandler显示Spring3和RichFaces的登录问题?,hibernate,spring,jsf,richfaces,Hibernate,Spring,Jsf,Richfaces,谢谢你读我的书 我有一个MVC模式的应用程序,包括Hibernate、JSF2、RichFaces、Spring3 我有登录表单,但不可能显示登录错误。。。为什么? 应用程序上下文: <sec:form-login login-page="/pages/loginPage.xhtml" login-processing-url="/j_spring_security_check" authentication-success-handler-ref="myAuthSuccessHand

谢谢你读我的书

我有一个MVC模式的应用程序,包括Hibernate、JSF2、RichFaces、Spring3

我有登录表单,但不可能显示登录错误。。。为什么?

应用程序上下文

<sec:form-login login-page="/pages/loginPage.xhtml"
 login-processing-url="/j_spring_security_check"
 authentication-success-handler-ref="myAuthSuccessHandler"
 authentication-failure-handler-ref="myAuthErrorHandler"/>
public class UserAuthenticationErrorHandler implements AuthenticationFailureHandler {
...
@Override
public void onAuthenticationFailure(HttpServletRequest request,
     HttpServletResponse response, AuthenticationException ae)
     throws IOException, ServletException {

    UsernamePasswordAuthenticationToken user = (UsernamePasswordAuthenticationToken)ae.getAuthentication();
    request.setAttribute("error", "Can you Show me???");
    response.sendRedirect("......");

}
...
}
最后是不显示错误的login.xhtml:(


哈贝马斯误差
有什么想法吗?非常感谢!


您好,是的,这没关系,但我的项目中没有JSTL标记库,只有JSF2…如果我没有JSTL标记库,我如何使用JSF2选项卡库编写atributte“error”?@ganzux:我不熟悉JSF。您可以简单地编写
${error}
,但它不会是HTML转义的。
<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />

        <c:out value="${error}"/>

        <c:if test="${not empty param.error}">
            Habemus error
        </c:if>
<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" /> 
request.setAttribute("error", "Can you Show me???");  
...
<c:out value="${error}"/> 
request.getSession().setAttribute("error", "Can you Show me???");  
<c:if test="${not empty param.error}">
response.sendRedirect("......?error=1");