我在 tomcat 中使用基于表单的身份验证,并且实际上正在使用 j_security_check。代码如下
<form method="POST" action="j_security_check">
<table>
<tr>
<td colspan="2">Login to the Tomcat-Demo application:</td>
</tr>
<tr>
<td>Name:</td>
<td><input type="text" name="j_username" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="j_password"/ ></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Go" /></td>
</tr>
</table>
</form>
我想使用已登录报告的用户。我想从会话中捕获已登录的用户。我的想法是使用下面的jsp语法来设置变量
<%
session.setAttribute("myName",request.getParameter("user"));
%>
但是,我不确定如何设置这样的会话变量,因为在身份验证后不久,它就会被重定向到请求的 URL
有人可以帮忙吗
问候阿里夫