本文作者:KTV免费预定

登录页面代码(京东登录页面代码)

KTV免费预定 2022-11-15 7

本文目录一览:

jsp登陆界面源代码

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

tdinput 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" ""

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

html

head

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

titleInsert 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" ""

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

brbrbrbrbrbr

h1 style="color:yellow"Login/h1

br

form name="loginForm" action="login_check.jsp" method="post" 

table Border="0"

tr

td账号/td

tdinput type="text" name="username"/td

/tr

tr

td密码/td

tdinput type="password" name="password"

/td

/tr

/table

br

input type="submit" value="登录" style="color:#BC8F8F"

/form

/center

/body

/html

如何用eclipse写登录注册页面的代码

java写登录页面代码的用户登录实例登录页面代码,实际页面展示使用登录页面代码的jsp登录页面代码,那么下面是jsp的登录页面代码登录页面代码

1、login.jsp代码

%

string name = request.getparameter("username");

string pwd = request.getparameter("password");

//out.println(name+pwd);

string sql ="select * from info where username='"+name+"' and password='"+pwd+"'";

//out.println(sql);

statement stm= null;

resultset rs =null;

try

{

stm = conn.createstatement();

rs = stm.executequery(sql);

if(rs.next())

{

session.setattribute("username",name);

response.sendredirect("index.html");

}

else

{

response.sendredirect("index1.html");

}

}

catch(sqlexception e)

{

e.printstacktrace();

}

%

!--登录的表单--

form name="form1" method="post" action="login.jsp"

p

label for="username"/label 用户名

input type="text" name="username" id="username"

/p

p

label for="passwrod"/label 密码

input type="text" name="passwrod" id="passwrod"

/p

p

input type="submit" name="button" id="button" value="提交"

/p

/form

2、用户信息表,存放用户名和密码:

user_info 表

create table if not exists `test` (

`id` int(8) not null auto_increment,

`username` char(150) default null,

`password` varchar(32),

`times` int(4) not null,

primary key (`id`)

) engine=myisam default charset=utf8 auto_increment=1 ;

用户登录html代码有哪些?

html

head

title登陆页面/title

/head

form action="login_conf.jsp" method="post"

用户登陆

用户名:input type="text" name="uname"

密码: input type="password" name="upassword"

input type="submit" value="提交"

input type="reset" value="重置"

/form

/body

/html

****************************************************

验证页面jsp代码如下:

html

head

title用户验证页面/title

/head

h1 登陆范例-登陆成功 /h1

/html

不知道你用啥样的前台 是jsp还是asp.net或者是php

世纪佳缘会员登录页面代码是什么

世纪佳缘 登录

登录

# _*_ coding:utf-8 _*_

import urllib2

import urllib

import cookielib

import re

# 通过cookiejar()类构建一个cookieJar对象,用来保存cookie的值

cookie = cookielib.CookieJar()

# 通过HTTPCookieProcessor()处理器类构建一个处理器对象,用来处理cookie

# 参数就是构建的CookieJar()对象

cookie_handler = urllib2.HTTPCookieProcessor(cookie)

# 构建一个自定义的opener

opener = urllib2.build_opener(cookie_handler)

# 通过自定义opener的addheaders的参数,可以添加HTTP报头参数

opener.addheaders = [('User-Agent',

'Mozilla/5.0 (windows NT 6.1; Win64; x64) APPleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36')]

# 世纪佳缘网登录接口

url = ';channel=1position=21refrer=;host=0'

def login_data(login_page):

# 填写自己的用户名和密码

login_data = {u'name': u'158*********',

u'password': u'12*********',

u'remem_pass': u'on'}

pattern = re.compile(r'input type="hidden" name="(\w+)" value="(\w+)"\s*/', re.U)

login_info = pattern.findall(login_page)

for item in login_info:

key, val = item

login_data[key] = val

return login_data

data = login_data(url)

# 通过urlencode()编码转换

data = urllib.urlencode(data)

# 第一次是POST请求,发送登录需要的参数,获取cookie

request = urllib2.Request(url, data=data)

response = opener.open(request)

print response.read()

望采纳。

阅读
分享