1.求jsp登录源码 急急急急急急急急急急急
2.jsp登陆界面源代码
求jsp登录源码 急急急急急急急急急急急
登陆页面 index.jsp源码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>login</title>
<meta .microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e)
{
e.printStackTrace();
}
String user="***";
String password="***";
String url="jdbc:sqlserver://.0.0.1:;DatabaseName=***";
Connection con=null;
try{
con=DriverManager.getConnection(url,登录登录user,password);
}catch(SQLException e)
{
e.printStackTrace();
}
return con;
}
public String selectPassword(String username)
{
Connection connection=getConnection();
String sql="select *from login where username=?";
PreparedStatement preparedStatement=null;
ResultSet result=null;
String password=null;
try{
preparedStatement=connection.prepareStatement(sql);
preparedStatement.setString(1,username);
result=preparedStatement.executeQuery();//可执行的 查询
if(result.next())
password=result.getString("password");
}catch(SQLException e){
e.printStackTrace();
}finally
{
close(preparedStatement);
close(result);
close(connection);
}
System.out.println("找到的数据库密码为:"+password);
return password;
}
public void close (Connection con)
{
try{
if(con!=null)
{
con.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close (PreparedStatement preparedStatement)
{
try{
if(preparedStatement!=null)
{
preparedStatement.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close(ResultSet resultSet)
{
try{
if(resultSet!=null)
{
resultSet.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
}
2、login_check.jsp:文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. 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>
<jsp:useBean id="util" class="util.Data_uil" scope="page" />
<%
String username=(String)request.getParameter("username");
String password=(String)request.getParameter("password");
if(username==null||"".equals(username))
{
out.print("<script language='javaScript'> alert('用户名不能为空');</script>");
response.setHeader("refresh",注册注册网游分销源码 "0;url=user_login.jsp");
}
else
{
System.out.println("输入的用户名:"+username);
String passwordInDataBase=util.selectPassword(username);
System.out.println("密码:"+passwordInDataBase);
if(passwordInDataBase==null||"".equals(passwordInDataBase))
{
out.print("<script language='javaScript'> alert('用户名不存在');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
else if(passwordInDataBase.equals(password))
{
out.print("<script language='javaScript'> alert('登录成功');</script>");
response.setHeader("refresh", "0;url=loginSucces.jsp");
}
else
{
out.print("<script language='javaScript'> alert('密码错误');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
}
%>
</body>
</html>
3、loginSucces.jsp文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
<title>Insert title here</title>
</head>
<body>
<hr size="" width="%" align="left" color="green">
<font size="6" color="red" >登录成功 </font>
<hr size="" width="%" align="left" color="green">
</body>
</html>
4、源码源代spi 源码分析user_login.jsp文件
登录登录快电源码<%@ page language="java" contentType="text/html; charset=utf-8"
登录登录快电源码pageEncoding="utf-8"%>
登录登录快电源码<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
登录登录快电源码<html>
登录登录快电源码<head>
登录登录快电源码<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
登录登录快电源码<title>登录界面</title>
登录登录快电源码</head>
登录登录快电源码<body background="C:\Users\win8\workspace\Login\image\9dcbdceab5cfbc_.jpg" >
登录登录快电源码<center>
登录登录快电源码<br><br><br><br><br><br>
登录登录快电源码<h1 style="color:yellow">Login</h1>
登录登录快电源码<br>
登录登录快电源码<form name="loginForm" action="login_check.jsp" method="post">
登录登录快电源码<table Border="0" >
登录登录快电源码<tr >
登录登录快电源码<td>账号</td>
登录登录快电源码<td><input type="text" name="username"></td>
登录登录快电源码</tr>
登录登录快电源码<tr>
登录登录快电源码<td>密码</td>
登录登录快电源码<td><input type="password" name="password">
登录登录快电源码</td>
登录登录快电源码</tr>
登录登录快电源码</table>
登录登录快电源码<br>
登录登录快电源码<input type="submit" value="登录" style="color:#BC8F8F">
登录登录快电源码</form>
登录登录快电源码</center>
登录登录快电源码</body>
登录登录快电源码</html>
登录登录快电源码登录登录快电源码2024-11-23 12:12
2024-11-23 11:50
2024-11-23 11:32
2024-11-23 11:27
2024-11-23 10:56
2024-11-23 10:38
2024-11-23 10:20
2024-11-23 10:12