jsp登陆界面源代码

作者&投稿:司马蒲 (若有异议请与网页底部的电邮联系)
JSP登陆界面程序源代码..会的急救..高分~




用户名

function RegsiterSubmit(){
with(document.Regsiter){
var user=document.Regsiter.loginName.value;
var pass=document.Regsiter.password.value;
if(user==null||user==""){
alert("请填写用户名");
}
else if(pass==null||pass==""){
alert("请填写密码");
}
else document.Regsiter.submit();
}
}







用户名:


密 码:








http://hi.baidu.com/wzqiajng/blog

1、login.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 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、judge.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>身份验证</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

String password = request.getParameter("password");

if(name.equals("abc")&& password.equals("123")) {

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=GB18030"

pageEncoding="GB18030"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>登录成功</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

out.println("欢迎你:" + name);

%>

</body>

</html>

扩展资料:

java web登录界面源代码:

1、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://127.0.0.1:1433;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.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>验证用户密码</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.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>

</head>

<body>

<hr size="10" width="26%" align="left" color="green">

<font size="6" color="red" >登录成功 </font>

<hr size="10" width="26%" 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.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>登录界面</title>

</head>

<body  background="C:\Users\win8\workspace\Login\image\9dcbdc339e72a5663b5c289fb5573c13_10.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>



login.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 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>

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://127.0.0.1:1433;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();

}

}

}



<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 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>

<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("GB18030");
String name = request.getParameter("userName");
String password = request.getParameter("password");
if(name.equals("abc")&& password.equals("123")) {

%>
<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=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>登录成功</title>
</head>
<body>
<%
request.setCharacterEncoding("GB18030");
String name = request.getParameter("userName");
out.println("欢迎你:" + name);
%>
</body>
</html>

总共3个jsp文件,第一个是login.jsp,第2个是judge.jsp,第3个是afterLogin.jsp

<%@
page
language="java"
contentType="text/html;
charset=GB18030"
pageEncoding="GB18030"%>
<%@
page
import="java.util.*"
%>
<!DOCTYPE
HTML
PUBLIC
"-//W3C//DTD
HTML
4.01
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>
<%@
page
language="java"
contentType="text/html;
charset=GB18030"
pageEncoding="GB18030"%>
<%@
page
import="java.util.*"
%>
<!DOCTYPE
HTML
PUBLIC
"-//W3C//DTD
HTML
4.01
Transitional//EN">
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("GB18030");
String
name
=
request.getParameter("userName");
String
password
=
request.getParameter("password");
if(name.equals("abc")&&
password.equals("123"))
{
%>
<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=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE
HTML
PUBLIC
"-//W3C//DTD
HTML
4.01
Transitional//EN">
<html>
<head>
<title>登录成功</title>
</head>
<body>
<%
request.setCharacterEncoding("GB18030");
String
name
=
request.getParameter("userName");
out.println("欢迎你:"
+
name);
%>
</body>
</html>
总共3个jsp文件,第一个是login.jsp,第2个是judge.jsp,第3个是afterLogin.jsp

用几个html标签组成就可以出来登录界面啊


sp系统忘了密码怎么开机
你可以常识。按着ctrl + alt + delete.连续按两下delete.出现一的windons经典登陆界面。输入administrator 密码空的。试一下。如果可以登陆。在里面修改一下帐号的密码就好了。这是一嗰管理员登陆的方式。如果不行。要用第三方软件破解,可以用光盘带有的。开机启动进入。还有一嗰方法比较复杂。就是在一...

dnf第三季加点模拟器sp怎么弄出来
从登陆界面(就是打帐号密码的那里)的上方,也就是那个dnf的旁边,有个“dnf游戏帮手”,你点进去,就可以找到加点模拟器了,加点模拟器在第三个

大家帮我找找这是哪个网站的登陆界面、
http:\/\/images.google.com.hk\/search?newwindow=1&safe=strict&tbs=sbi:AMhZZisLufhEo6PvHNLVYgktv_1TkHgbowmRFINCuJD2qwtgbhGuD8tpI35VlN5L_1HoRTZHfiaBWepTVrnKI_1pmGmYqDuiG2Lbe_1Cvg3ig_18DUb7HVXb8O0OCPVFBkbWsQIORj7EhpyhnTcmuipXZcD5iXmo8E4Z-YyBsdWsOCU8HIT4-fDOAXXHxxtepdtG1U...

大家帮我找找这是哪个网站的登陆界面、
http:\/\/images.google.com.hk\/search?newwindow=1&safe=strict&tbs=sbi:AMhZZisLufhEo6PvHNLVYgktv_1TkHgbowmRFINCuJD2qwtgbhGuD8tpI35VlN5L_1HoRTZHfiaBWepTVrnKI_1pmGmYqDuiG2Lbe_1Cvg3ig_18DUb7HVXb8O0OCPVFBkbWsQIORj7EhpyhnTcmuipXZcD5iXmo8E4Z-YyBsdWsOCU8HIT4-fDOAXXHxxtepdtG1...

用手机上网如何登录网易通行证
首先手机上网千万要开通GPRS包月,不然很贵的,开通个包30或者50M流量。然后你到网上下一个浏览器,随便什么浏览器都行,就可以上互联网的网站了,上了163自然可以登陆通行证。

如何判断苹果6sp是不是翻新机?
判断苹果6sp是不是翻新机具体操作如下:首先是开箱,开包装后先别开机,摇一摇听听是否有很大的响声,按键是否很松动。然后再看一下机身是否有磕磕碰碰掉漆现象 然后看摄像头有无进灰现象,各个手机细节缝隙部分也仔细看看。开机激活,如果此机器开机直接进入手机界面了,那说明是二手的,开机跳出白苹果时,...

理光sp325sfnw怎么扫描
理光 SP325SFNW 无线wifi打印机一体机复印扫描传真多功能扫面打印机 扫描教程步骤:首先打开理光打印一体机,电源灯亮。这时登陆电脑,打开IE游览器的理光一体机IP地址,登陆界面。登陆管理员账户,在地址薄里面添加用户,进行用户设置。即完成第一步。第二步,点击打开机器上的scanner扫描功能键。打开机器最...

SQL Server2008 数据库忘记登录密码了怎么办
记着,是重启服务,不是关掉sqlserver2008然后再打开。具体方法是在数据库实例上点右键,选择“重新启动”项即可。最后关闭sql server2008,启动后用sa登陆。如果忘记了sa的登录密码,可以先用windows身份认证登录进去,然后新建查询,输入命令: EXECUTE sp_password NULL,'输入新密码','sa'设置sa新的...

魔兽私服
8. 自己玩或者局域网内玩游戏,进游戏登陆界面后按“~”打开控制台,输入“realmlist (你在“7.”所输入的内网IP)”使用wow表account项里面的GM账号登陆游戏。OK!架设完毕!scripts\/items.scp(物品资料与代码)scripts\/creatures.scp(npc资料与代码)saves\/players.save(玩家资料)scripts\/areatriggescripts\/items.scp(...

sp代收费是什么意思?
SP代收费是指联通公司为第三方服务经营者代收的费用,包括代收联通在信信息费、代收信息台信息费以及其他增值业务代收的信息费。您可登陆网上营业厅http:\/\/iservice.10010.com\/ 点击话费查询 >账单查询 >SP代收费,即可查询近5个月的SP代收费信息,您还可联系当地人工客服或前往当地营业厅进行查询。您...

邯郸县17151448695: jsp登陆界面源代码 -
弥之万适: <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ page import="java.util.*" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <...

邯郸县17151448695: 求JSP登陆界面代码 -
弥之万适: 原发布者:rsamt privateStringuserid; privateStringpassword; publicvoidsetUserId(Stringuserid) { this.userid=userid; } publicvoidsetPassword(Stringpassword) { this.password=password; } publicString getUserId() { returnthis.userid; } ...

邯郸县17151448695: 求JSP登陆界面代码
弥之万适: 给你提供一下思路吧. 1.输入界面:输入用户名和密码. 2.处理界面:获取提交过来的数据(用户名和密码),然后进行验证.然后填写正确时,跳转成功的界面;不正确时,跳转失败的界面. 3.创建成功界面与失败界面. 你看这样能理解吗...

邯郸县17151448695: jsp 登陆界面的代码
弥之万适: 实验目标 写一个JSP界面,用来模拟模拟用户登陆邮件系统的过程. 实现4项功能: 1. 登陆;(action = login) 2. 查看信箱;(action = check) 3. 注销登陆.(action = logout) 4. 直接访问系统时,提示登陆信息. 实现方法 ,用一个request参数action来标识要进行的操作. 1. 登陆;(action = login) 2. 查看信箱;(action = check) 3. 注销登陆.(action = logout) 4. 未指定 action 时,提示登陆信息.(action =)

邯郸县17151448695: JSP作业,求大神写代码!编制一个简单的登录界面. -
弥之万适: 第一个页面命名:Login.html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>Login.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="...

邯郸县17151448695: 求JSP验证登录代码 -
弥之万适: 首先这里需要一个表单 来包围你的两个输入筐 <br><div align="center"> <br><form method="post" action="login.jsp"><br><pre>用户名:<input class="top_userlogin" name="textfield" type="text" size="20" />密码:<input class...

邯郸县17151448695: 需要一个jsp登陆注册页面的完整代码,链接sql -
弥之万适: 以下是和sql2000连接的,字段名只是参考,相信对你有帮助.如果是和其他数据库连接只要修改连接部分的语句,网上都有格式.这个是登陆的代码:String no=new String(); no=request.getParameter("no"); String psw=new String(); psw=...

邯郸县17151448695: 求大神写一下jsp的简单的注册界面代码. -
弥之万适: 1.需要一个jsp页面://login.jsp核心代码:<form action="${pageContext.request.contextPath}/servlet/UserServlet" method="post"><input type="text" name="loginname" /><input type="password" name="password"/><input type="...

邯郸县17151448695: 用jsp怎样做一个用户登录界面 -
弥之万适: //jsp文件,登录界面 <%@page pageEncoding="utf-8" contentType="text/html; charset = utf-8"%> <body> <h1>Register</h1> <hr /> <form action="login" method="post"> 用户名:š <input type="text" name="username" id="text...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网