Spring Security - Authentication Failure - Empty Message

I am working on a spring-mvc web application.

On my login page, if the user enters bad credentials, I want to display an error message.

So I tried to use spring to display an error message, but I cannot display any message.

login.jsp

for the login form, I linked as:

<form method="post" action="<c:url value='/j_spring_security_check' />" id="loginForm">
.... login ui
</form>

to display the error:

<c:if test="${not empty param.error}">
    <div>
        <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>
    </div>
</c:if> 

security context.xml

<form-login login-page="/login" default-target-url="/home" always-use-default-target="false" authentication-failure-url="/login?error=true" />

after enabling all of these options, you still cannot display an error message if you have bad credentials.

Let me know if you want any other information.

PS: , . . UserDetailsContextMapper, UsernameNotFoundException

+1
1

, . , :

<%@ page session="false"%>

:

<%@ page session="true"%>

. , , - , , . . .

0

All Articles