📄 login.jsp~1~
字号:
<%@ page contentType="text/html; charset=gb2312" %><%@ page session="true" %><jsp:useBean id="alogin" scope="page" class="check.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("user.jsp"); %><% }else { mesg = "登录出错!" ; }}%><html><head><title>>使用seesion对象进行身份验证</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript"> function checkform() { if (document.form1.username.value=="" || document.form1.passwd.value==""){ alert("用户名或密码为不能为空!"); return false; } return true; }</script><link rel="stylesheet" href="books.css" type="text/css"><style type="text/css"><!--body { background-image: url(../../mypicture/bg06.jpg);}.style2 { color: #669900; font-size: 16px;}.style4 {color: #CC6666}.style5 {color: #669900}--></style></head><body text="#000000"><div align="center"> <p class="style2">用户登录</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" align="right"><span class="style5">用户名:</span><br> </td> <td width="246" valign="top"> <input type="text" name="username" size="16" maxlength="25"> </td> </tr> <tr> <td width="147" align="right"><span class="style5">密 码:</span></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());"> <input type="reset" name="Submit2" value="取消"> </td> </tr> <tr> <td colspan="2" align="center"> <p> </p> <p><span class="style4">如果你还没有注册,请</span><a href="reg.jsp">注册</a></p> </td> </tr> </table> </form> <p> </p></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -