入门级JavaWeb的多类用户登陆注册系统

项目介绍:

这是一个简单的登陆注册系统,可以注册用户和商户两种账号,登陆时可以用三种账号登陆:管理员、商户、用户,登陆后进入各自不同的界面。

数据库用的MySQL。建了4张表:

admin的字段:

store和user的字段:

student的字段:

至于数据,就自己随便写一些就行。

界面效果:

该样式的图片和css源码:

login.css

@charset "utf-8";
/* CSS Document */

* { font: 13px/1.5 '微软雅黑'; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -box-sizing: border-box; padding:0; margin:0; list-style:none; box-sizing: border-box; }
body, html { height:100%; overflow:hidden; }
body { background:#93defe; background-size: cover; }
a { color:#27A9E3; text-decoration:none; cursor:pointer; }
img{ border:none;}

.login_box{ width:1100px; margin:120px auto 0;}
.login_box .login_l_img{ float:left; width:432px; height:440px; margin-left:50px;}
.login_box .login_l_img img{width:500px; height:440px; }
.login {height:360px; width:400px; padding:50px; background-color: #ffffff;border-radius:6px;box-sizing: border-box; float:right; margin-right:50px; position:relative; margin-top:50px;}
.login_logo{ width:120px; height:120px; border:5px solid #93defe;border-radius:100px; background:#fff; text-align:center; line-height:110px; position:absolute; top:-60px; right:140px;}
.login_name{ width:100%; float:left; text-align:center; margin-top:20px;}
.login_name p{ width:100%; text-align:center; font-size:18px; color:#444; padding:10px 0 20px;}
.login_logo img{ width:60px; height:60px;display: inline-block; vertical-align: middle;}
input[type=text], input[type=file], input[type=password], input[type=email], select { border: 1px solid #DCDEE0; vertical-align: middle; border-radius: 3px; height: 50px; padding: 0px 16px; font-size: 14px; color: #555555; outline:none; width:100%;margin-bottom: 15px;line-height:50px; color:#888;}
input[type=text]:focus, input[type=file]:focus, input[type=password]:focus, input[type=email]:focus, select:focus { border: 1px solid #27A9E3; }
input[type=submit], input[type=button] { display: inline-block; vertical-align: middle; padding: 12px 24px; margin: 0px; font-size:16px; line-height: 24px; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; color: #ffffff; background-color: #27A9E3; border-radius: 3px; border: none; -webkit-appearance: none; outline:none; width:100%; }
.copyright { font-size:14px; color:#fff; display:block;width:100%; float:left; text-align:center; margin-top:60px;}

#password_text{border: 1px solid #DCDEE0; vertical-align: middle; border-radius: 3px; height: 50px; padding: 0px 16px; font-size: 14px; color: #888; outline:none; width:100%;margin-bottom: 15px;display: block; line-height:50px;}

1.后台代码:

路径结构:

扫描二维码关注公众号,回复: 3001113 查看本文章
package control;

import java.sql.DriverManager;

import java.sql.*;

import com.mysql.jdbc.Connection;


public class ConnectSql {
	
	private static String driver = "com.mysql.jdbc.Driver";
	
	private static String url = "jdbc:mysql://127.0.0.1:3306/my_test?characterEncoding=utf8&useSSL=false";
	
	private static String user = "root";
	
	private static String password = "abc123";
	
	/*public static void main(String[] args) {
		Connection conn = null;
		try {
			Class.forName(driver);
			conn = (Connection)DriverManager.getConnection(url, user, password);
			System.out.println("Success connect Mysql server!");
			
			Statement stmt = conn.createStatement();
	        ResultSet rs = stmt.executeQuery("select * from admin");
	        
	        while(rs.next()) {
	        	System.out.print(rs.getInt(1)+" ");
	        	System.out.print(rs.getInt(2)+" ");
	        	System.out.print(rs.getString(3)+" ");
	        	System.out.print(rs.getString(4)+" ");
	        	System.out.print(rs.getInt(5)+" ");
	        	System.out.println(rs.getString(6));
	        }
		}catch (Exception e) {
			e.printStackTrace();
		}
	}*/
	public static Connection getConn(String db,String table) {
		Connection conn = null;
		try {
			Class.forName(driver);
			String url1 = url.replace("my_test", db);
			conn = (Connection)DriverManager.getConnection(url1, user, password);
			System.out.println("成功连接数据库"+db);
			
			Statement stmt = conn.createStatement();
	        ResultSet rs = stmt.executeQuery("select * from "+table);
	        ResultSetMetaData rsmd = rs.getMetaData(); 
	        System.out.println("查看表:"+table);
	        int col = rsmd.getColumnCount();
	        System.out.println(col);
	        while(rs.next()) {
	        	for(int i = 1;i <= col;i++) {
	        		System.out.print(rs.getObject(i)+" ");
	        	}
	        	System.out.println();
	        }
		}catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
	
}
package control;

import java.sql.*;

import model.User;

public class login {

	public int ask(String id,String pwd) {
		
		ConnectSql sql = new ConnectSql();
		if (id.equals("sa")) {
			try {
				Connection conn = sql.getConn("my_test", "admin");

				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from admin";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						/*String index = "admin.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("管理员登陆成功!2s后跳转到<a href=" + index + ">后台管理</a>");
						response.addHeader("refresh", "2;URL=admin.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
						rs.close();
						conn.close();
						return 1;
					}
					
					
				}
				rs.close();
				conn.close();
				//out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} else if(id.substring(0, 2).equals("sj")){
			try {
				Connection conn = sql.getConn("my_test", "store");
				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from store";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						/*String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("商家登陆成功!2s后跳转到<a href=" + index + ">商家页面</a>");
						response.addHeader("refresh", "2;URL=store.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
						rs.close();
						conn.close();
						return 2;
					}
					
					
				}
				rs.close();
				conn.close();
				//out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else {
			try {
				Connection conn = sql.getConn("my_test", "user");
				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from user";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						/*String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("用户登陆成功!2s后跳转到<a href=" + index + ">欢迎页</a>");
						response.addHeader("refresh", "2;URL=index.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
						rs.close();
						conn.close();
						return 3;
					}
					
					
				}
				rs.close();
				conn.close();
				//out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return 0;
	}
}
package control;

import java.sql.*;

import model.User;

public class register {
	
	public boolean add(User user,String id) {
		
		PreparedStatement pst = null;
		ConnectSql sql = new ConnectSql();
		
		if(id.substring(0, 2).equals("sj")){
			try{
				Connection conn = sql.getConn("my_test", "store");
				
				String u = null;
				Statement st = conn.createStatement();
				String s = "insert into store (id,password,email,name,age,sex,money) values (?,?,?,?,?,?,?)";
				String ss = "select * from store";
				ResultSet rs = st.executeQuery(ss);
				boolean flag = false;
				while (rs.next()) {
					u = rs.getString("id");
					if(u.equals(id)){
						flag = true;
						break;
					}
				}
				if(!flag){
					pst=conn.prepareStatement(s);
					pst.setString(1,user.getId());
					pst.setString(2,user.getPassword());
					pst.setString(3,user.getEmail());
					pst.setString(4,user.getName());
					pst.setString(5,user.getAge());
					pst.setString(6,user.getSex());
					pst.setString(7, user.getMoney());
					pst.executeUpdate();
					/*String index = "login.jsp?username=" + URLEncoder.encode(id, "utf-8");
					out.println("注册成功!2s后跳转到<a href=" + index + ">登陆界面</a>");
					response.addHeader("refresh", "2;URL=login.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
					rs.close();
					conn.close();
					return true;
				}else{
					/*out.println("当前账号已经注册过了");
					String index = "register.jsp?username=" + URLEncoder.encode(id, "utf-8");
					out.println("注册失败!2s后跳转到<a href=" + index + ">注册界面</a>");
					response.addHeader("refresh", "2;URL=register.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
					rs.close();
					conn.close();
					return false;
				}
			}catch(Exception e){
				e.printStackTrace();
			}
		}else {
			try{
				Connection conn = sql.getConn("my_test", "user");
				
				String u = null;
				Statement st = conn.createStatement();
				String s = "insert into user (id,password,email,name,age,sex,money) values (?,?,?,?,?,?,?)";
				String ss = "select * from user";
				ResultSet rs = st.executeQuery(ss);
				boolean flag = false;
				while (rs.next()) {
					u = rs.getString("id");
					if(u.equals(id)){
						flag = true;
						break;
					}
				}
				if(!flag){
					pst=conn.prepareStatement(s);
					pst.setString(1,user.getId());
					pst.setString(2,user.getPassword());
					pst.setString(3,user.getEmail());
					pst.setString(4,user.getName());
					pst.setString(5,user.getAge());
					pst.setString(6,user.getSex());
					pst.setString(7, user.getMoney());
					pst.executeUpdate();
					/*String index = "login.jsp?username=" + URLEncoder.encode(id, "utf-8");
					out.println("注册成功!2s后跳转到<a href=" + index + ">登陆界面</a>");
					response.addHeader("refresh", "2;URL=login.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
					rs.close();
					conn.close();
					return true;
				}else{
					/*out.println("当前账号已经注册过了");
					String index = "register.jsp?username=" + URLEncoder.encode(id, "utf-8");
					out.println("注册失败!2s后跳转到<a href=" + index + ">注册界面</a>");
					response.addHeader("refresh", "2;URL=register.jsp?username=" + URLEncoder.encode(id, "utf-8"));*/
					rs.close();
					conn.close();
					return false;
				}
			}catch(Exception e){
				e.printStackTrace();
			}
		}
		return false;
	}
}
package model;

import java.sql.*;

public class Book {

	private String id;
	private String name;
	private int number;
	private int price;
	
	public 	Book(String id,String name,int number,int price) {
		this.id = id;
		this.name = name;
		this.number = number;
		this.price = price;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getNumber() {
		return number;
	}
	public void setNumber(int number) {
		this.number = number;
	}
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	
}
package model;

import java.sql.*;

public class User {
	private String id;
	private String password;
	private String email;
	private String name;
	private String age;
	private String sex;
	private String money;
	
	public User(String id,String password,String email,String name,String age,String sex,String money) {
		this.id = id;
		this.password = password;
		this.email = email;
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.money = money;
	}
	
	public String getMoney() {
		return money;
	}

	public void setMoney(String money) {
		this.money = money;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAge() {
		return age;
	}
	public void setAge(String age) {
		this.age = age;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	
	
}

2.前台代码:

路径结构

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>欢迎进入管理系统</h1>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.net.URLDecoder"%>
<!doctype html>
<html>
<head>欢迎页</head>
<body>
	<h1>欢迎光临</h1>
</body>
</html>
<%@page import="java.net.URLEncoder"%>
<%@ page language="java" import="java.sql.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="control.*"%>
<%@ page import="model.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登陆验证</title>
</head>
<body>
	<%
		String id = request.getParameter("username");
		String pwd = request.getParameter("password");
		request.setAttribute("username", id);
		
		login lo = new login();
		int i = lo.ask(id,pwd);
		if(i == 1){
			String index = "admin.jsp?username=" + URLEncoder.encode(id, "utf-8");
			out.println("管理员登陆成功!2s后跳转到<a href=" + index + ">后台管理</a>");
			response.addHeader("refresh", "2;URL=admin.jsp?username=" + URLEncoder.encode(id, "utf-8"));
		}else if(i == 2){
			String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
			out.println("商家登陆成功!2s后跳转到<a href=" + index + ">商家页面</a>");
			response.addHeader("refresh", "2;URL=store.jsp?username=" + URLEncoder.encode(id, "utf-8"));
		}else if(i == 3){
			String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
			out.println("用户登陆成功!2s后跳转到<a href=" + index + ">欢迎页</a>");
			response.addHeader("refresh", "2;URL=index.jsp?username=" + URLEncoder.encode(id, "utf-8"));
		}else{
			out.println("用户名或密码错误");
		}
/* 		ConnectSql sql = new ConnectSql();

		if (id.equals("sa")) {
			try {
				Connection conn = sql.getConn("my_test", "admin");

				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from admin";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						String index = "admin.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("管理员登陆成功!2s后跳转到<a href=" + index + ">后台管理</a>");
						response.addHeader("refresh", "2;URL=admin.jsp?username=" + URLEncoder.encode(id, "utf-8"));
						rs.close();
						conn.close();
						return;
					}
					
					
				}
				rs.close();
				conn.close();
				out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} else if(id.substring(0, 2).equals("sj")){
			try {
				Connection conn = sql.getConn("my_test", "store");
				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from store";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("商家登陆成功!2s后跳转到<a href=" + index + ">商家页面</a>");
						response.addHeader("refresh", "2;URL=store.jsp?username=" + URLEncoder.encode(id, "utf-8"));
						rs.close();
						conn.close();
						return;
					}
					
					
				}
				rs.close();
				conn.close();
				out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else {
			try {
				Connection conn = sql.getConn("my_test", "user");
				String u = null;
				String p = null;
				Statement st = conn.createStatement();
				String s = "select * from user";
				ResultSet rs = st.executeQuery(s);
				while (rs.next()) {
					u = rs.getString("id");
					p = rs.getString("password");
					if (u.equals(id) && p.equals(pwd)) {
						String index = "index.jsp?username=" + URLEncoder.encode(id, "utf-8");
						out.println("用户登陆成功!2s后跳转到<a href=" + index + ">欢迎页</a>");
						response.addHeader("refresh", "2;URL=index.jsp?username=" + URLEncoder.encode(id, "utf-8"));
						rs.close();
						conn.close();
						return;
					}
					
					
				}
				rs.close();
				conn.close();
				out.println("用户名或密码错误");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} */
	%>
	<form>
		<input type="hidden" name="username" value="${param.username}">
		<input type="button" value="重新登陆"
			onclick="this.form.action='login.jsp';this.form.submit();">
	</form>
</body>
</html>
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户登陆</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
</head>
<body>

	<div class="login_box">
		<div class="login_l_img">
			<img src="images/login-img.png" />
		</div>
		<div class="login">
			<div class="login_logo">
				<a href="#"><img src="images/login_logo.png" /></a>
			</div>
			<div class="login_name">
				<p>欢迎登陆</p>
			</div>
			<form  name="form" action="login_validate.jsp" method="post">
				<input name="username" type="text" value="用户名"
					onfocus="this.value=''"
					onblur="if(this.value==''){this.value='用户名'}"> <span
					id="password_text"
					onclick="this.style.display='none';document.getElementById('password').style.display='block';document.getElementById('password').focus().select();">密码</span>
				<input name="password" type="password" id="password"
					style="display: none;"
					onblur="if(this.value==''){document.getElementById('password_text').style.display='block';this.style.display='none'};" />
				<input value="登录" style="width: 100%;" type="submit">
				<hr>
				<a href="register.jsp"><input value="注册" style="width: 100%;" type="button"></a>
			</form>
		</div>
		<div class="copyright">桦哥有限公司 版权所有©2022-99999 技术支持电话:15354511033</div>
	</div>
</body>
</html>
<%@page import="java.net.URLEncoder"%>
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="control.*"%>
<%@ page import="model.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册验证</title>
</head>
<body>
	<%
	String id = request.getParameter("id");
	String password = request.getParameter("password");
	String email = request.getParameter("email");
	String name = request.getParameter("name");
	String age = request.getParameter("age");
	String sex = request.getParameter("sex");
	String money = request.getParameter("money");
	request.setAttribute("id", id);
	//out.println(id+password+email+name+age+sex);
	//PreparedStatement pst = null;
	//ConnectSql sql = new ConnectSql();
	User user = new User(id,password,email,name,age,sex,money);
	register re = new register();
	if(re.add(user,id)){
		String index = "login.jsp?username=" + URLEncoder.encode(id, "utf-8");
		out.println("注册成功!2s后跳转到<a href=" + index + ">登陆界面</a>");
		response.addHeader("refresh", "2;URL=login.jsp?username=" + URLEncoder.encode(id, "utf-8"));
	}else{
		out.println("当前账号已经注册过了");
		String index = "register.jsp?username=" + URLEncoder.encode(id, "utf-8");
		out.println("注册失败!2s后跳转到<a href=" + index + ">注册界面</a>");
		response.addHeader("refresh", "2;URL=register.jsp?username=" + URLEncoder.encode(id, "utf-8"));
	}
	
/* 	if(id.substring(0, 2).equals("sj")){
		try{
			Connection conn = sql.getConn("my_test", "store");
			
			String u = null;
			Statement st = conn.createStatement();
			String s = "insert into store (id,password,email,name,age,sex) values (?,?,?,?,?,?)";
			String ss = "select * from store";
			ResultSet rs = st.executeQuery(ss);
			boolean flag = false;
			while (rs.next()) {
				u = rs.getString("id");
				if(u.equals(id)){
					flag = true;
					break;
				}
			}
			if(!flag){
				pst=conn.prepareStatement(s);
				pst.setString(1,id);
				pst.setString(2,password);
				pst.setString(3,email);
				pst.setString(4,name);
				pst.setString(5,age);
				pst.setString(6,sex);
				pst.executeUpdate();
				String index = "login.jsp?username=" + URLEncoder.encode(id, "utf-8");
				out.println("注册成功!2s后跳转到<a href=" + index + ">登陆界面</a>");
				response.addHeader("refresh", "2;URL=login.jsp?username=" + URLEncoder.encode(id, "utf-8"));
				rs.close();
				conn.close();
				return;
			}else{
				out.println("当前账号已经注册过了");
				String index = "register.jsp?username=" + URLEncoder.encode(id, "utf-8");
				out.println("注册失败!2s后跳转到<a href=" + index + ">注册界面</a>");
				response.addHeader("refresh", "2;URL=register.jsp?username=" + URLEncoder.encode(id, "utf-8"));
				rs.close();
				conn.close();
				return;
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}else {
		try{
			Connection conn = sql.getConn("my_test", "user");
			
			String u = null;
			Statement st = conn.createStatement();
			String s = "insert into user (id,password,email,name,age,sex) values (?,?,?,?,?,?)";
			String ss = "select * from user";
			ResultSet rs = st.executeQuery(ss);
			boolean flag = false;
			while (rs.next()) {
				u = rs.getString("id");
				if(u.equals(id)){
					flag = true;
					break;
				}
			}
			if(!flag){
				pst=conn.prepareStatement(s);
				pst.setString(1,id);
				pst.setString(2,password);
				pst.setString(3,email);
				pst.setString(4,name);
				pst.setString(5,age);
				pst.setString(6,sex);
				pst.executeUpdate();
				String index = "login.jsp?username=" + URLEncoder.encode(id, "utf-8");
				out.println("注册成功!2s后跳转到<a href=" + index + ">登陆界面</a>");
				response.addHeader("refresh", "2;URL=login.jsp?username=" + URLEncoder.encode(id, "utf-8"));
				rs.close();
				conn.close();
				return;
			}else{
				out.println("当前账号已经注册过了");
				String index = "register.jsp?username=" + URLEncoder.encode(id, "utf-8");
				out.println("注册失败!2s后跳转到<a href=" + index + ">注册界面</a>");
				response.addHeader("refresh", "2;URL=register.jsp?username=" + URLEncoder.encode(id, "utf-8"));
				rs.close();
				conn.close();
				return;
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	} */
	
	%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户注册</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="login_box">

		<div class="login_name">
			<p>欢迎注册</p>
		</div>
		<form name="form" action="register_validate.jsp" method="post">
			<p>如果是商家注册,请在用户名前加上‘sj’两个字母</p>
			<input name="id" type="text" value="用户名" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='用户名'}"> 
			
			<input
				name="password" type="text" value="密码" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='密码'}"> 
			<input
				name="email" type="text" value="邮件" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='邮件'}"> 
			<input
				name="name" type="text" value="姓名" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='姓名'}"> 
			<input
				name="age" type="text" value="年龄" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='年龄'}"> 
			<input
				name="sex" type="text" value="性别" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='性别'}"> 
			<input
				name="money" type="text" value="注册资金" onfocus="this.value=''"
				onblur="if(this.value==''){this.value='注册资金'}"> 
			<input
				value="确认" style="width: 100%;" type="submit">
			<hr>
			<a href="login.jsp"><input value="取消" style="width: 100%;"
				type="button"></a>
		</form>

	</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>欢迎出售你的商品</h1>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/zhiyeegao/article/details/82187018