java网页制作
java网页制作,用Eclipse做的,主要前两页登入注册的,还要连接SQL数据库,的,其他做成什么类型的都可以,简单点。今明两天,尽快。满意再加50QQ10859383...
java网页制作,用Eclipse做的,主要前两页登入注册的,还要连接SQL数据库,的,其他做成什么类型的都可以,简单点。
今明两天,尽快。满意再加50
QQ 1085938327 展开
今明两天,尽快。满意再加50
QQ 1085938327 展开
3个回答
展开全部
运行环境 vista+tomcat+mysql
reg.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<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">
</head>
<body>
<form name="form1" method="post" action="\file\WebRoot\insert.jsp">
<table width="500" border="0" align="center" bgcolor="#aad0d7" height="250">
<tbody>
<tr><td valign="top"><br></td><td valign="top"><br></td></tr><<tr>
<td>姓 名 <br></td>
<td> <input type="text" name="username"></td></tr>
<tr>
<td>邮 箱 <br></td>
<td> <input type="text" name="usermail"></td></tr>
<tr>
<td>密 码 <br></td>
<td> <input type="password" name="password"></td></tr>
<tr>
<td>密码确认 <br></td>
<td> <input type="password" name="password2"></td></tr>
<tr>
<td> </td>
<td> </td></tr>
<tr>
<td> <input type="submit" value="提交" name="button"></td>
<td> <input type="reset" value="重置" name="button2"></td></tr>
</tbody></table>
</form>
</body>
</html>
insert.jsp
<%@ page language="java" import="java.sql.*" 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>insert</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">
</head>
<body>
<%
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager
.getConnection(
"jdbc:mysql://localhost:3306/file?useUnicode=true&?characterEncoding=gbk",
"root", "xxxxxxx");
String UserName = request.getParameter("username");
String UserMail = request.getParameter("usermail");
String UserPassword = request.getParameter("password");
String sql = "insert into tbluser (UserName,UserMail,UserPassword)values(?,?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, UserName);
pstmt.setString(2, UserMail);
pstmt.setString(3, UserPassword);
pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
out.println("aaaaa");
}
%>
</body>
</html>
reg.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<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">
</head>
<body>
<form name="form1" method="post" action="\file\WebRoot\insert.jsp">
<table width="500" border="0" align="center" bgcolor="#aad0d7" height="250">
<tbody>
<tr><td valign="top"><br></td><td valign="top"><br></td></tr><<tr>
<td>姓 名 <br></td>
<td> <input type="text" name="username"></td></tr>
<tr>
<td>邮 箱 <br></td>
<td> <input type="text" name="usermail"></td></tr>
<tr>
<td>密 码 <br></td>
<td> <input type="password" name="password"></td></tr>
<tr>
<td>密码确认 <br></td>
<td> <input type="password" name="password2"></td></tr>
<tr>
<td> </td>
<td> </td></tr>
<tr>
<td> <input type="submit" value="提交" name="button"></td>
<td> <input type="reset" value="重置" name="button2"></td></tr>
</tbody></table>
</form>
</body>
</html>
insert.jsp
<%@ page language="java" import="java.sql.*" 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>insert</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">
</head>
<body>
<%
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager
.getConnection(
"jdbc:mysql://localhost:3306/file?useUnicode=true&?characterEncoding=gbk",
"root", "xxxxxxx");
String UserName = request.getParameter("username");
String UserMail = request.getParameter("usermail");
String UserPassword = request.getParameter("password");
String sql = "insert into tbluser (UserName,UserMail,UserPassword)values(?,?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, UserName);
pstmt.setString(2, UserMail);
pstmt.setString(3, UserPassword);
pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
out.println("aaaaa");
}
%>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
HI我。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
download from many web site. it's very easy.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询