I am using auth-method FORM with apache tomcat to authenticate users. I am using the default j_security_check action.
Else a sign in link. How do I check if the user has signed in?
您可以使用HttpServletRequest.getUserPrincipal()
并检查它以查找登录用户。
登录状态与HttpServletRequest.getUserPrincipal()
返回非null的条件相同。
if(request.authenticate(response)){
System.out.println("The User is Authenticated");
}else{
System.out.println("The User is not Authenticated");
}
Use this code inside your JSP or in the Servlets.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.