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

📄 register.jsp

📁 jsp+sqlserver2000+tomcat做的教材管理系统。基本功能全部实现
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上海海事大学教材管理系统,信息053设计</title>
<style type="text/css">
<!--
body {
	background-image: url(MainImages/background.gif);
}
.STYLE1 {
	color: #FFFFFF;
	font-family: "宋体";
	font-size: 12px;
}
.STYLE2 {
	color: #FFFFFF;
	font-size: 36px;
	font-weight: bold;
}
.STYLE3 {
	color: #FFFFFF;
	font-size: 12px;
	font-weight: bold;
}
.STYLE6 {color: #FFFFFF; font-size: 12px; font-weight: bold; font-family: "宋体"; }
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFFFFF;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
	color: #FFFFFF;
}
.STYLE7 {
	font-size: 18px;
	font-weight: bold;
	font-family: "宋体";
}
.STYLE8 {color: #FFFFFF}
.STYLE9 {
	font-size: 12px;
	font-weight: bold;
	font-family: "宋体";
}
-->
</style></head>
<jsp:useBean id="myRs" scope="page" class="utils.DBManager" />
	<%
		String sql = null;
		java.sql.ResultSet rs = null;
		String message = "";
		String type = "";
		String userid = "";
		String password = "";
	%>
	<%
		request.setCharacterEncoding("gb2312");
		type = request.getParameter("type");
		if(type!=null){
		userid = request.getParameter("userid");
		password = request.getParameter("password");
		String sql1 = "insert into users (levels,";
		String sql2 = "values(1,";
		if (userid != null) {
			sql1 += "userid,";
			sql2 += "'" + userid + "',";
		}
		if (password != null) {
			sql1 += "password,";
			sql2 += "'" + password + "',";
		}
		sql1 = sql1.substring(0, sql1.length() - 1);
		sql2 = sql2.substring(0, sql2.length() - 1);
		sql1 += ")";
		sql2 += ")";
		sql = sql1 + sql2;

		try {
			int i = myRs.executeUpdate(sql);
			message = "<font color=#FFFFFF face='宋体' size=2>注册用户成功!</font><a href=\"../index.jsp\">登录</a>";
		} catch (Exception e) {
			e.printStackTrace();
			message = "          <font color=#FFFFFF face='宋体' size=2>注册用户失败!该用户已存在,请后退,或者重新注册!</font>";
		} finally {
			myRs = null;
		}
	}
	%>
<body>
<table width="773" height="450" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
    <td height="115" align="center" valign="middle" background="MainImages/background.gif"><div align="center"><img src="MainImages/logo.gif" width="64" height="64" /><img src="MainImages/smutitle.gif" width="268" height="64" /><span class="STYLE2">教材管理系统</span></div>
    <p align="right" class="STYLE3">上海海事大学信息053,zd8695设计</p></td>
  </tr>
  
  <tr>
    <td height="256" background="MainImages/background.gif"><table width="489" height="234" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr><td> <div align="center" class="STYLE7">&nbsp;&nbsp;&nbsp;&nbsp; <span class="STYLE8">用户注册</span></div></td> 
	</tr>
      <tr>  
        <td height="57">
		<form name="form" method="post" action="register.jsp?type=add">
		<div align="center"><span class="STYLE6">注册账号:</span>
		  <input type="text" name="userid" style="width:120px;height:15px;">
		  </div>
		<p align="center">
		<span class="STYLE6">注册密码:</span>
		<input type="password" name="password" style="width:120px;height:15px;">
		<p align="center">&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	  
	<input type="submit" name="Submit" value="注册">
		<a href="../index.jsp" class="STYLE9">回到主页</a>
		</form> </td>
      </tr>
      <tr>
        <td height="32"><center>
<%=message%>
        </center></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="40" background="MainImages/background.gif"><div align="center"><span class="STYLE1"><strong>Copyright&copy;2008 </strong>上海海事大学信息053 </span></div></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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