例如,在每个页面上,我都允许用户授权自己。但在行动中,我每次都LoginAction
将他移到那里,因为返回带有操作的 url
。main.jsp
req.getRequestURI
localhost:8080/reservation/LoginAction.do
这是LoginAction
HttpSession session = req.getSession();
log.debug("attempt to checkuser");
String login = req.getParameter("login");
String password = req.getParameter("password");
if (loginService.checkExists(login, password)) {
session.setAttribute("enterAttr", true);
session.setAttribute("loginame", login);
return "main";
}
session.setAttribute("enterAttr", false);
return "redirect:/reservation/main.jsp";
如何获取引起操作的页面?
页面上的表格如下所示
<form action="LoginAction.do" method="POST">
<div id="table"
class="ui-widget-header ui-corner-all ui-widget-content">
<table align="center" style="width: 100%">
<tr>
<td align="center"><span
style="color: white; font-size: 20px;"><fmt:message
key="lg" /></span></td>
<td align="right"><input type="text" id="login" name="login" />
<td>
</tr>
<tr>
<td align="center"><span
style="color: white; font-size: 20px;"><fmt:message
key="paswd" /></span></td>
<td align="right"><input type="password" id="password"
name="password" /></td>
</tr>
<tr>
<td align="right" colspan="2"><input type="submit"
id="approve" style="font-size: 10px;"
value="<fmt:message key='enter'/>" /></td>
</tr>
</table>
</div>
</form>