?? login.jsp
字號(hào):
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page session="true" %>
<jsp:useBean id="login" scope="page" class="bookshop.run.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"));
login.setUsername(username);
login.setPasswd(passwd);
out.print(username+passwd);
if (login.excute()){
session.setAttribute("username",username);
String userid = Long.toString(login.getUserid());
session.setAttribute("userid",userid);
response.sendRedirect("booklist.jsp");
%>
<%
}else {
mesg = "登錄出錯(cuò)!" ;
}
}
%>
<%@include file="/bookshop/inc/head.inc"%>
<script language="javascript">
function checkform() {
if (document.form1.username.value=="" || document.form1.passwd.value==""){
alert("用戶名或密碼為空!");
return false;
}
return true;
}
</script>
<div align=center>用戶登錄 </div>
<br>
<% 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" align="center">
<tr>
<td width="147" align="right">用戶名:<br>
</td>
<td width="246" valign="top">
<input type="text" name="username" size="16" maxlength="25">
</td>
</tr>
<tr>
<td width="147" align="right">密 碼:</td>
<td width="246" valign="top">
<input type="password" name="passwd" maxlength="20" size="16">
</td>
</tr>
<tr>
<td width="147" align="right"> </td>
<td width="246" valign="top">
<input type="submit" name="Submit" value="登錄" onclick="javascript:return(checkform());">
<a> </a>
<input type="reset" name="Submit2" value="取消">
</td>
</tr>
<tr>
<td colspan="2" align="center">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<p> </p>
<p>如果你還不是本站用戶,請(qǐng)?jiān)诖?lt;a href="reg.jsp">注冊(cè)</a></p>
</td>
</tr>
</table>
</form>
<%@include file="/bookshop/inc/tail.inc"%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -