前端页面处理如下:
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td><input size="20" class="TextField" name="loginName" type="text"></td>
<td rowspan="2" style="padding-left:10px;"><input src="../style/blue/images/login/userLogin_button.gif" type="image"></td>
</tr>
<tr>
<td><input size="20" class="TextField" name="password" type="password"></td>
</tr>
<span style="color:#ff0000;"> <tr>
<td id="my_msg" colspan="3" style="text-align: center;color: white">用户名或密码错误!</td>
</tr></span>
</tbody></table>
js处理如下:
<span style="color:#ff0000;"><script type="text/javascript">
$(document).ready(
function() {
var my_msg = $("#my_msg");
my_msg.hide();
if('${msg}'=='false'){
my_msg.show();
}
});
</script></span>
即先将标签隐藏起来,当request域msg为false时,显示错误信息,则登录失败;否则登录成功,跳到主页。