📄 login.jsp
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page session="true"%>
<jsp:useBean id="alogin" scope="page" class="com.bookshop.dao.Login" />
<%
String mesg = "";
if (request.getParameter("username") != null
&& !request.getParameter("username").equals(""))
{
String username = request.getParameter("username");
String passwd = request.getParameter("passwd");
username = new String(username.getBytes("ISO8859-1"));
passwd = new String(passwd.getBytes("ISO8859-1"));
alogin.setUsername(username);
alogin.setPasswd(passwd);
if (alogin.excute())
{
session.setAttribute("username", username);
String userid = Long.toString(alogin.getUserid());
session.setAttribute("userid", userid);
response.sendRedirect("userinfo.jsp");
%>
<%
} else
{
mesg = "登录出错!";
}
}
%>
<html>
<head>
<title>51网络电子书店--用户登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>a{TEXT-DECORATION:none}a:hover{TEXT-DECORATION:underline}</style>
<script language="JavaScript">
setInterval("a.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script>
<script language="javascript">
function checkform() {
if (document.form1.username.value=="" || document.form1.passwd.value==""){
alert("用户名或密码为空!");
return false;
}
return true;
}
</script>
<style type="text/css">
<!--
.style2 {color: #000000}
.style14 {color: #3366FF}
.style16 {font-size: 18px; color: #3366FF;}
-->
</style>
<link rel="stylesheet" href="books.css" type="text/css">
</head>
<body text="#000000">
<div align="center">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><img src="images/title.jpg" width="750" height="100"></td>
</tr>
</table>
<table width="750" border="0" cellspacing="1" cellpadding="1" >
<tr>
<td width="100" height="30" align="center" background="images/qntj.jpg"><a href="index.jsp" class="style14">首页</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="booklist.jsp" class="style14">在线购物</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="shoperlist.jsp" class="style14">我的购物车</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="login.jsp" class="style14">用户登录</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="manage/login.jsp" class="style14">网站管理</a></td>
<td width="250" align="center" background="images/qntj.jpg"><div id="a"><span class="style7"></span></div></td>
</tr>
</table>
<p class="style16">
51书店用户登录
</p>
<%
if (!mesg.equals(""))
{
out.println("<p>" + mesg + "</p>");
}
%>
<form name="form1" method="post" action="login.jsp">
<table width="400" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="147" height="25" align="right">
<span class="style14">用户名</span><br>
</td>
<td width="246" valign="top" height="25">
<input type="text" name="username" size="16" maxlength="25" height="20">
</td>
</tr>
<tr>
<td width="147" height="25" align="right" class="style14">
密 码</td>
<td width="246" valign="top" height="26">
<input type="password" name="passwd" maxlength="20" size="16" height="20">
</td>
</tr>
<tr>
<td width="147" height="25" align="right">
</td>
<td width="246" valign="top" height="25">
<input type="submit" name="Submit" value="登录"
onClick="javascript:return(checkform());">
<input type="reset" name="Submit2" value="取消">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<p>
</p>
<p>
如果你还不是本站用户,请在此
<a href="reg.jsp" class="style16">注册</a>
</p>
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
<hr width="750" color="#00CCFe"/>
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" >
<div align="center" class="style11">06计算机科学与技术3班<br>
CopyRight@2009
<br>
E-mail:
<a href="http://mail.163.com">Jinlf112@163.com</a>
</div></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -