日期:2014-05-17 浏览次数:20670 次
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>注册页面</title>
</head>
<body>
<form action="Register.jsp" method="post">
<table align="center">
<tr><td colspan="2">用户注册</td></tr>
<tr><td>帐 号:</td><td><input type="text" name="username"/></td></tr>
<tr><td>密 码:</td><td><input type="text" name="userpassword"/></td></tr>
<tr><td colspan="2"><input type="submit"value="注册">
<input type="reset"value="重置"></td></tr></table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*"%>
<html>
<head>
<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>
<body>
<%request.setCharacterEncoding("gb2312");
String reqUsername=(String)request.getParameter("username");
System.out.println(reqUsername);
String reqPassword=(String)request.getParameter("userpassword");
System.out.println(reqPassword); %>
<%
String url="jdbc:mysql://localhost:3306/javaweb";
String user="root";
String password="123456";
Connection conn=null;
PreparedStatement pstmt=null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url,user,password);
}
catch(ClassNotFoundException e){
out.println("找不到驱动类");
}
catch(SQLException e){
out.println("无法连接MYSQL");}
try{
&nbs