📄 login.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*" %>
<jsp:useBean id="data" scope="page" class="shop.data.conn" />
<style type="text/css">
<!-- @import url(images/css.css); -->
</style>
<script language="JavaScript">
function check()
{
if(document.login.id.value.length==0)
{
alert("请填写您的用户名");
document.login.id.focus();
return false;
}
if(document.login.pwd.value.length==0)
{
alert("请填写您的登陆密码");
document.login.pwd.focus();
return false;
}
}
</script>
<br><br><br><br><br><br><br><br><br>
<form action="" method="post" name="login" onSubmit="return check()">
<input type="hidden" name="loginthis" value="">
<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40" colspan="3">
<%
String loginthis=request.getParameter("loginthis");
if(loginthis!=null && loginthis.equals("true"))
{
String id=request.getParameter("id");
String pwd=request.getParameter("pwd");
String sql="select * from manager where name='"+id+"' and pwd='"+pwd+"'";
ResultSet rs=data.executeQuery(sql);
if(!rs.next())
{%>
<div align="center"><font color="#FF0000">对不起,您的用户名或密码错误</font></div>
<%}else{
session.putValue("manager",id);
response.sendRedirect("index.jsp");
}}
%>
</td>
</tr>
<tr>
<td width="80" height="20"><div align="right">用户名:</div></td>
<td width="10"></td>
<td><input type="text" name="id" size="15" maxtlength="10" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"></td>
</tr>
<tr>
<td height="20"><div align="right">密 码:</div></td>
<td></td>
<td><input type="password" name="pwd" size="15" maxlength="10" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva"></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td height="30" colspan="3"><div align="center">
<input name="submit" type="submit" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" onClick="document.all.loginthis.value='true';" value="登陆">
<input name="button" type="button" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" onClick="javascript:window.close()" value="关闭">
</div></td>
</tr>
</table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -