Jsp写的简单的网页通讯录管理.docx

上传人:b****8 文档编号:11209310 上传时间:2023-02-25 格式:DOCX 页数:53 大小:23.55KB
下载 相关 举报
Jsp写的简单的网页通讯录管理.docx_第1页
第1页 / 共53页
Jsp写的简单的网页通讯录管理.docx_第2页
第2页 / 共53页
Jsp写的简单的网页通讯录管理.docx_第3页
第3页 / 共53页
Jsp写的简单的网页通讯录管理.docx_第4页
第4页 / 共53页
Jsp写的简单的网页通讯录管理.docx_第5页
第5页 / 共53页
点击查看更多>>
下载资源
资源描述

Jsp写的简单的网页通讯录管理.docx

《Jsp写的简单的网页通讯录管理.docx》由会员分享,可在线阅读,更多相关《Jsp写的简单的网页通讯录管理.docx(53页珍藏版)》请在冰豆网上搜索。

Jsp写的简单的网页通讯录管理.docx

Jsp写的简单的网页通讯录管理

Login.jsp

<%@pagelanguage="java"contentType="text/html;charset=gb2312"

pageEncoding="gb2312"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:

//www.w3.org/TR/html4/loose.dtd">

//www.w3.org/1999/xhtml">

登陆

body{background:

#29497b;}

.logo-box{

position:

absolute;

top:

36px;

left:

85px;

background:

#29497brighttopno-repeat;

width:

320px;

}

.logo-boxh1{font-size:

40px;height:

50px;line-height:

50px;color:

#FFF}

.header{height:

150px;width:

980px;margin:

auto;position:

relative;color:

#fff;}

.wrapper{background:

#233e69;width:

100%;height:

400px;}

.content{width:

980px;margin:

auto;position:

relative;height:

100%;}

.msg-box{width:

480px;height:

100%;text-align:

center;}

.msg-boximg{vertical-align:

middle;}

.login-box{

position:

absolute;

top:

26px;

right:

-26px;

width:

448px;

height:

219px;

padding:

4px7px10px8px;

background:

#FFF;

}

.loginbtn{

border:

0none;

color:

#204497;

cursor:

pointer;

height:

27px;

width:

68px;

}

varxmlHttp=null;

functionshowHint(id)

{

switch(id){

case"username":

if(document.getElementById(id).value=="")

{

document.getElementById("user").innerHTML="用户名不能为空";

return;

}else{

document.getElementById("user").innerHTML="";

return;

}

case"password":

if(document.getElementById(id).value=="")

{

document.getElementById("pass").innerHTML="密码不能为空";

return;

}else{

//repwd=document.getElementById(id).value;

document.getElementById("pass").innerHTML="";

return;

}

}

try

{//Firefox,Opera8.0+,Safari,IE7

xmlHttp=newXMLHttpRequest();

}

catch(e)

{//OldIE

try

{

xmlHttp=newActiveXObject("Microsoft.XMLHTTP");

}

catch(e)

{

alert("YourbrowserdoesnotsupportXMLHTTP!

");

return;

}

}

}

通讯录管理中心

block">

15px;color:

#666">用户名:

100%"onblur="showHint(this.id)"/>

1px;color:

red">

15px;color:

#666">密 码:

100%"onblur="showHint(this.id)"/>

1px;color:

red">

url(login_btn.png);width:

282px;height:

38px"onclick="showHint()">没有账号?

Check.jsp

<%@pagelanguage="java"contentType="text/html;charset=gb2312"

pageEncoding="gb2312"%>

<%@pageimport="java.sql.*"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:

//www.w3.org/TR/html4/loose.dtd">

check

<%

Stringusername=request.getParameter("username");

Stringpassword=request.getParameter("password");

StringDriver="com.mysql.jdbc.Driver";

Stringurl="jdbc:

mysql:

//127.0.0.1:

3306/addressbook";

Stringuser="root";

Stringpass="mysql";

try{

Class.forName(Driver);

Connectioncon=DriverManager.getConnection(url,user,pass);

PreparedStatementpst=con.prepareStatement("select*fromuserwhereusername=?

andpassword=?

");

pst.setString(1,username);

pst.setString(2,password);

ResultSetrs=pst.executeQuery();

if(rs.next()){

session.setAttribute("user",username);

response.sendRedirect("success.jsp");

}else{

response.sendRedirect("error.jsp");

}

}catch(ClassNotFoundExceptione){

out.println("加载类错误");

}catch(SQLExceptione){

out.println("数据库异常");

}catch(Exceptione){

e.printStackTrace();

}

%>

Success.jsp

<%@pagelanguage="java"contentType="text/html;charset=gb2312"

pageEncoding="gb2312"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:

//www.w3.org/TR/html4/loose.dtd">

success

body{background:

#29497b;}

.header{height:

150px;width:

980px;margin:

auto;position:

relative;color:

#fff;}

.logo-box{

position:

absolute;

top:

36px;

left:

85px;

background:

#29497brighttopno-repeat;

width:

320px;

}

.logo-boxh1{font-size:

40px;height:

50px;line-height:

50px;color:

#FFF}

.success{

background-image:

url(zz.png);

position:

absolute;

left:

349px;

top:

198px;

width:

426px;

height:

195px;

}

通讯录管理中心

欢迎<%=session.getAttribute("user")%>,3秒后将自动跳转到主页面

<%

response.setHeader("refresh","3;url=addressbook.jsp");%>

如浏览器没有跳转,请点击这里

Error.jsp

<%@pagelanguage="java"contentType="text/html;charset=gb2312"

pageEncoding="gb2312"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:

//www.w3.org/TR/html4/loose.dtd">

success

body{background:

#29497b;}

.header{height:

150px;width:

980px;margin:

auto;position:

relative;color:

#fff;}

.logo-box{

position:

absolute;

top:

36px;

left:

85px;

background:

#29497brighttopno-repeat;

width:

320px;

}

.logo-boxh1{font-size:

40px;height:

50px;line-height:

50px;color:

#FFF}

.success{

background-color:

#FFF;

position:

absolute;

left:

349px;

top:

198px;

width:

426px;

height:

195px;

}

通讯录管理中心

登录失败,3秒后将自动跳转到主页面

<%

response.setHeader("refresh","3;url=login.jsp");%>

如浏览器没有跳转,请点击这里

Register.jsp

<%@pagelanguage="java"contentType="text/html;charset=gb2312"

pageEncoding="gb2312"%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

注册

h2{color:

red;

font-size:

5px;}

body{background-color:

#099;}

td{

width:

100px;

}

body{background:

#29497b;}

.index{

background-color:

#29497b;

position:

absolute;

left:

907px;

top:

95px;

width:

63px;

height:

42px;

}

.logo-box{

position:

absolute;

top:

36px;

left:

85px;

background:

#29497brighttopno-repeat;

width:

320px;

}

.logo-boxh1{font-size:

40px;height:

50px;line-height:

50px;color:

#FFF}

.header{height:

150px;width:

980px;margin:

auto;position:

absolute;color:

#fff;}

.msg-box{width:

480px;height:

100%;text-align:

center;}

.msg-boximg{vertical-align:

middle;}

.content{

width:

979px;

margin:

auto;

position:

absolute;

height:

427px;

left:

12px;

top:

167px;

}

.reg{

width:

567px;

margin:

auto;

position:

absolute;

height:

360px;

left:

494px;

top:

26px;

}

varxmlHttp=null;

functionshowHint(id)

{

switch(id){

case"username":

if(document.getElementById(id).value=="")

{

document.getElementById("user").innerHTML="用户名不能为空";

return;

}else{

document.getElementById("user").innerHTML="";

return;

}

case"password":

if(document.getElementById(id).value=="")

{

document.getElementById("pass").innerHTML="密码不能为空";

return;

}elseif(document.getElementById(id).value.length<6){

document.getElementById("pass").innerHTML="密码不能少于6位";

return;

}else{

//repwd=document.getElementById(id).value;

document.getElementById("pass").innerHTML="";

return;

}

case"repwd":

if(document.getElementById(id).value!

=document.getElementById("password").value)

{

document.getElementById("rep").innerHTML="两次密码不一致";

return;

}else{

document.getElementById("rep").innerHTML="";

return;

}

case"email":

varstr=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

if(document.getElementById(id).value=="")

{

document.getElementById("mail").innerHTML="邮箱不能为空";

return;

}elseif(!

str.test(email.value))

{

document.getElementById("mail").innerHTML="邮箱格式错误";

return;

}else

{

document.getElementById("mail").innerHTML="";

return;

}

}

try

{//Firefox,Opera8.0+,Safari,IE7

xmlHttp=newXMLHttpRequest();

}

catch(e)

{//OldIE

try

{

xmlHttp=newActiveXObject("Microsoft.XMLHTTP");

}

catch(e)

{

alert("YourbrowserdoesnotsupportXMLHTTP!

");

return;

}

}

}

通讯录管理中心

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 哲学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1