0
例如在我允許用戶自己授權的每個頁面上。但在行動LoginAction
我每次將他移動到main.jsp
,因爲req.getRequestURI
返回帶有動作的url 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>
你讀到它的行爲像這樣'string value = req.getGetparameter(redirect_page)'? – lapots
是的...這就是我使用這種方式 –