<%@ 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>User to Register Page!</title> </head> <body> <hr><br>Welcome to this <font color="green">Enroll(Register) Page</font>!<br> <form action="do_register.jsp" method="get"> <br> <h1>Please input your message:</h1><br> Name:<input type="text" name="register_name"><br> Pswd:<input type="password" name="register_password"><br> <br><br><br> <input type="submit"> <input type="reset"><br> </body> </html>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!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>Server to do the register page!</title>
</head>
<body>
<%
String Register_name=request.getParameter("register_name");
String Register_password=request.getParameter("register_password");
%>
<%
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/summer", "root", "mysql");
Statement stmt=conn.createStatement();
//desogn the sql statement
String InsertSQL="INSERT INTO User(Name,Password) values('"+Register_name+"','"+Register_password+"')";
System.out.println(Register_name+"\t"+Register_password);
//do the query operation,and here is the most important sql statement.
int FLAG=stmt.executeUpdate(InsertSQL);
if(FLAG>0){
response.getWriter().write("Congratulation! REgister Success!");
}else{
response.getWriter().write("Sorry!Register Failed!\nPlease Retry it!");
}
}catch(SQLException e){
}
%>
</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>User Login Page</title> </head> <body> <hr><br>Welcome to this <font color="green">Login Page</font>!<br> <form action="do_login.jsp" method="get"> <br> <h1>Please input your message:</h1><br> Name:<input type="text" name="name"><br> Pswd:<input type="password" name="password"><br> <br><br><br> <input type="submit"> <input type="reset"><br> Click me to <font color="green"><a href="register.jsp">Register</a>!</font><br> </form> </body> </html>
<%@page import="java.sql.DriverManager"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!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>Server Page Depend !</title>
</head>
<body>
<h3>Which Pae will be depend by the user's message!</h3>
<%
String name=request.getParameter("name");
String password=request.getParameter("password");
%>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/summer", "root", "mysql");
Statement stmt=conn.createStatement();
//desogn the sql statement
String queryNumberSQL="SELECT Name from User where Name='"+name+"' and Password='"+password+"'";
//do the query operation
ResultSet rs=stmt.executeQuery(queryNumberSQL);
boolean flag=false;
if(rs.next()){
flag=true;
session.setAttribute("UserName", name);
}else{
flag=false;
}
%>
<%
if(flag){
%>
<jsp:forward page="login_success.jsp"></jsp:forward>
<%
}else{
%>
<jsp:forward page="login_failed.jsp"></jsp:forward>
<%
}
%>
</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>User Login Success Page!</title>
</head>
<body>
<hr><br>
<h1>Login Success!</h1><br>
<font color="green">Welcome <%=session.getAttribute("UserName") %>!</font>
<h3 align="center">your persional Message is:</h3>
<%
out.println("Name:"+session.getAttribute("UserName"));
%>
<font color="red"><a href="login.jsp">Click me</a> to log out!</font>
</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>Login Failed Page!</title> </head> <body> <hr> <br> <h1><font color="red">Sorry,Login Failed</font></h1><br> <font color="red"><a href="login.jsp">Click me</a> to login!</font> </body> </html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有