⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.jsp

📁 jsp+servlet经典的登录注册
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>网上书城登录</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
 	<style type="text/css">
	<!--
	 .STYLE1 {font-size: 14px; color: #0000FF}
	-->
</style>
  <link rel="stylesheet" href="bbs.css">
<script language="javascript">
function checkForm() {	
	//if (document.form1.username.value == "") {
		//alert("请输入用户名");
		//form1.username.focus();
		//return false;
	//}	
	if(document.forms.form1.userName.value == ""){
		window.alert("用户名不允许为空,请输入用户名!");
		document.forms.form1.userName.focus();
		//document.forms.form1.userName.value == "";
		//document.forms.form1.passWord.value == "";
		return false;
	}
	if(document.forms.form1.passWord.value == ""){
		window.alert("密码不允许为空,请输入密码!");
		document.forms.form1.passWord.focus();
		//document.forms.form1.userName.value == "";
		//document.forms.form1.passWord.value == "";
		return false;
	}
	document.form1.submit();
}
function resetForm() {
	document.form1.reset();
}
</script>
  <body bgcolor="#FF9900" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
     <br>
     <br>
     <table width="100" border="0" cellpadding="0" cellspacing="0" align="center">
     <tr>
     <td><img src="login_user.gif" width="266" height="32"></td>
     </tr>
     <tr align="center" valign="middle">
     <td>
     	<form action="servlet/CheckServlet" method="get" name="form1">
     		<table align="center">
     			<tr bgcolor="#FFFF99">
     				<td width="38%" align="right"><span class="STYLE1">用户名:</span>
     				</td>
     				<td width="62%">
     				<input type="text" name="userName">
     				</td>
     			</tr>
     			<tr bgcolor="#FFFF99">
     			<td width="38%" align="right"><span class="STYLE1">密码:</span>
     			</td>
     			<td width="62%">
     			<input type="password" name="passWord">
     			</td>
     			</tr>
     			<tr bgcolor="#FFFF99">
     			<td width="38%" align="right"><span class="STYLE1">注册:</span>
     			</td>
     			<td width="62%">
     			<!-- 这里是一个超连接 --> <a href="register.jsp"><span class="STYLE1">申请注册</span></a>
				</td>
     			</tr>
     		</table>
     	</form>
     </td>
     </tr>
     	<tr bgcolor="#FF9900" valign="middle" align="center">
     		<td height="20"><img src="login_down.gif" width="266" height="20">
     		</td>
     	</tr>
     	<tr bgcolor="#FF9900" valign="middle" align="center">
     		<td height="50"><img src="button_1.gif" width="52" height="21" onclick="checkForm();" style="cursor:hand">
     		<img src="button_2.gif" width="52" height="21" onclick="resetForm();" style="cursor:hand">
     		</td>
     	</tr>
     </table>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -