1.jsp登陆界面源代码
jsp登陆界面源代码
1、网页网页login.jsp文件<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录页面</title>
</head>
<body>
<form name="loginForm" method="post" action="judgeUser.jsp">
<table>
<tr>
<td>用户名:<input type="text" name="userName" id="userName"></td>
</tr>
<tr>
<td>密码:<input type="password" name="password" id="password"></td>
</tr>
<tr>
<td><input type="submit" value="登录" style="background-color:pink"> <input
type="reset" value="重置" style="background-color:red"></td>
</tr>
</table>
</form>
</body>
</html>
2、源码qq冻结查询源码judge.jsp文件
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
String password = request.getParameter("password");
if(name.equals("abc")&& password.equals("")) {
3、工具源码制作的过程afterLogin.jsp文件
%>
<jsp:forward page="afterLogin.jsp">
<jsp:param name="userName" value="<%=name%>"/>
</jsp:forward>
<%
}
else {
%>
<jsp:forward page="login.jsp"/>
<%
}
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录成功</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
out.println("欢迎你:" + name);
%>
</body>
</html>
扩展资料:
java web登录界面源代码:1、网页网页vs源码在哪打开Data_uil.java文件
import java.sql.*;
public class Data_uil
{
public Connection getConnection()
{
try{
Class.forName("com.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、网页网页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-29 23:132239人浏览
2024-11-29 23:07951人浏览
2024-11-29 22:032059人浏览
2024-11-29 21:57658人浏览
2024-11-29 21:38726人浏览
2024-11-29 21:181123人浏览
1.数据资产管理平台体系拆解(4):元数据管理数据资产管理平台体系拆解(4):元数据管理 阅读本文需要分钟,以数据之名,践资产之行。 1、以数据之名 简介 2、元数据的基本概念 2.1
1.如何查找源代码2.格式化硬盘时需要"启用压缩"吗如何查找源代码 工具如何查找源代码 1、首先打开电脑的ie浏览器进去,如下图所示。进入ie浏览器首页后,点击查看,如下图所示。在查看菜单下选
1.python导入模块的语句2.怎么获取网页源代码中的文件3.Eclipse如何导入web项目 Eclipse导入web项目详细攻略教程python导入模块的语句 Python导入模块的语句是: