How to display login error message at login.jsp pa

2019-03-06 02:39发布

I am using Spring Security. I want to display login error message on login.jsp such as login failed or account locked. How can I display such message on login page ?

1条回答
【Aperson】
2楼-- · 2019-03-06 03:08

Just configure authentication-failure-url to a Servlet and set an attribute from that servlet like

request.setAttribute("errorMessage",putYourMessageHere);

and forward this request to login page.

Or provide

authentication-failure-url as login.jsp?authValid=false

check for the param on jsp

${param.authFailed}

and print the message conditionally

查看更多
登录 后发表回答