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:
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