用户使用Apache Shiro和JSP重新登录时如何重定向到主页

时间:2018-11-09 06:11:38

标签: java jsp shiro

我是Apache Shiro和JSP的新手。现在,我可以使用Shiro登录了。但是,如果用户已登录并且URL上的登录页面中的用户密钥直接像PartnerDetails一样,系统会将用户重定向到登录页面,因此用户继续输入用户名和密码,然后再输入该用户即使用户名和密码正确,也将永远停留在那里。在我的localhost/testing/login.jsp中,我放置了shiro.ini,它适用于首次登录,但是如果我刚才提到的Scenerio不会重定向。

这是登录表单

authc.successUrl  = /index.jsp

这是我的<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Login Page</title> </head> <body> <section id="login"> <form name="loginform" action="" method="POST" accept-charset="UTF-8"> <div> <input type="text" id="username" name="username"> <label for="username">Username</label> </div> <div> <input type="password" id="password" name="password"> <label for="password">Password</label> </div> <div> <input type="submit" value="Login"> <input type="checkbox" id="rememberMe" name="rememberMe"> <label for="rememberMe">rememberMe</label> </div> </form> </section> </body> </html> 部分文件,

shiro.ini

1 个答案:

答案 0 :(得分:0)

只需放

<shiro:authenticated>
<c:redirect url="index.jsp"/>
</shiro:authenticated>

在您的登录页面的前几行html