Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx

上传人:b****1 文档编号:607423 上传时间:2023-04-29 格式:DOCX 页数:12 大小:18.42KB
下载 相关 举报
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第1页
第1页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第2页
第2页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第3页
第3页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第4页
第4页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第5页
第5页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第6页
第6页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第7页
第7页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第8页
第8页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第9页
第9页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第10页
第10页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第11页
第11页 / 共12页
Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx

《Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx(12页珍藏版)》请在冰点文库上搜索。

Jsp学生信息管理系统登录验证全代码Word格式文档下载.docx

divid="

b2bContent”

style="

FILTER:

revealTrans(Duration=1,Transition=23);

WIDTH:

100%;

HEIGHT:

162px”〉〈/div〉

〈/font〉〈/td〉

〈/tr〉

<

tr>

〈tdalign=centerSTYLE=’cursor:

hand’〉〈fontsize=2>

〈divclass=”b2bbutton"

id="

bt0”

onclick="

javascript:

showPage(0);

clearTimeout(theTimer);

theTimer=setTimeout('

turnPage()’,speed);

checkBt();

"

〉1〈/div>

〈/font〉〈/td>

hand'

〉<

fontsize=2〉

〈divclass="

b2bbutton"

id=”bt1"

onclick=”javascript:

showPage

(1);

clearTimeout(theTimer);

theTimer=setTimeout(’turnPage()'

speed);

checkBt();

”>

2<

/div〉

〈/font>

〈/td〉

tdalign=centerSTYLE=’cursor:

divclass=”b2bbutton"

bt2"

showPage

(2);

turnPage()’,speed);

3〈/div〉

〈/font〉<

/td>

〈tdalign=centerSTYLE='

cursor:

hand’>

〈divclass=”b2bbutton”id="

bt3"

showPage(3);

turnPage()’,speed);

4〈/div>

divclass=”b2bbutton”id=”bt4"

showPage(4);

turnPage()'

,speed);

〉5<

/td〉

fontsize=2>

id=”bt5"

showPage(5);

6<

/div>

〈/td>

/tr〉

/table〉

〈scriptlanguage=”javascript"

b2bStr=newArray();

b2bStr[0]="

〈divstyle='

float:

left;

width:

100%;

overflow:

hidden;

’〉〈ahref=1。

giftarget=_blank〉<

imgsrc=1。

gifwidth=214pxheight=145pxborder=0〉〈/a〉〈br〉<

atarget=_blanktitle=太阳岛公园一角href=1.gif〉太阳岛公园一角<

/a〉<

”;

b2bStr[1]="

divstyle='

left;

overflow:

hidden;

’〉〈ahref=2.giftarget=_blank>

〈imgsrc=2。

gifwidth=214pxheight=145pxborder=0>

/a〉〈br>

〈atarget=_blanktitle=太阳岛公园湖光山色href=2.gif〉太阳岛公园湖光山色〈/a>

〈/div>

b2bStr[2]=”<

divstyle=’float:

100%;

’〉<

ahref=3。

giftarget=_blank>

imgsrc=3.gifwidth=214pxheight=145pxborder=0〉<

/a>

〈br〉<

atarget=_blanktitle=哈尔滨雪雕href=3。

gif>

哈尔滨雪雕〈/a〉〈/div>

”;

b2bStr[3]=”<

float:

width:

100%;

'

ahref=4.giftarget=_blank>

〈imgsrc=4.gifwidth=214pxheight=145pxborder=0〉〈/a>

br>

〈atarget=_blanktitle=镜泊湖href=4。

gif〉镜泊湖〈/a〉<

/div〉”;

b2bStr[4]="

ahref=5.giftarget=_blank>

〈imgsrc=5.gifwidth=214pxheight=145pxborder=0>

〈/a〉<

atarget=_blanktitle=太阳岛公园瀑布href=5。

太阳岛公园瀑布〈/a>

b2bStr[5]="

〈divstyle=’float:

ahref=6.giftarget=_blank〉<

imgsrc=6.gifwidth=214pxheight=145pxborder=0>

〈br〉〈atarget=_blanktitle=镜泊湖夜色href=6。

gif〉镜泊湖夜色〈/a〉〈/div〉"

;

varpage=0;

varspeed=3000;

functionshowPage(id){

page=id;

setTransition();

b2bContent.innerHTML=b2bStr[id];

b2bContent。

filters.revealTrans。

play();

}

functionturnPage(){

showPage(page);

theTimer=setTimeout("

turnPage()"

,speed);

checkBt();

page++;

if(page>

=6)page=0;

functioncheckBt(){

for(vari=0;

i<

6;

i++){

btObj=eval('

bt'

+i);

if(page==i){btObj。

style.color='

#FFFFFF’;

btObj。

style.backgroundColor=’#FF781C'

else{btObj.style。

color=’#000000’;

btObj.style.backgroundColor='

#F7F7F7’;

functionsetTransition(){

b2bContent.filters。

revealTrans.Transition=Math.round(Math。

random()*23);

filters.revealTrans.apply();

turnPage();

〈/script〉〈/TD>

<

/TR〉

〈hrcolor=”green"

width=”540"

〈tablealign="

center”〉

〈td>

用户名:

inputtype=”text"

name="

username"

size="

8”maxlength=”6"

〈/tr>

td〉密&

nbsp;

&

&nbsp;

码:

inputtype=”password”name="

password"

10”maxlength=”6”〉<

〈td〉

〈inputtype=”submit"

value=”登录"

>

nbsp;

〈inputtype="

reset"

value="

取消”〉

〈/td>

/tr>

〈/table>

〈/form〉

〈/body>

〈/html>

2。

java代码

(1)User.Java定义的属性和数据库中的字段相对应

packagecom。

softeem.dt;

publicclassUser{

privateintid;

privateStringusername;

privateStringpassword;

privateStringxh;

privateStringcollege;

publicintgetId(){

returnid;

publicvoidsetId(intid){

this.id=id;

}

publicStringgetUsername(){

returnusername;

publicvoidsetUsername(Stringusername){

this.username=username;

publicStringgetPassword(){

returnpassword;

publicvoidsetPassword(Stringpassword){

this.password=password;

publicStringgetXh(){

returnxh;

publicvoidsetXh(Stringxh){

this.xh=xh;

publicStringgetCollege(){

returncollege;

publicvoidsetCollege(Stringcollege){

this。

college=college;

(2)UserDAO。

java操作数据库tb_user,验证用户登录

softeem.dao;

importjava.sql。

Connection;

importjava。

sql。

PreparedStatement;

ResultSet;

importjava.sql.SQLException;

importcom。

softeem.db.DBManager;

softeem.dt.User;

publicclassUserDAO{

/**

*验证用户登录

*@return

*/

publicbooleancheckDenglu(Useruser){

booleanflag=false;

//获得数据库连接

Connectionconn=DBManager。

getConnection();

//用select*from查询数据库中的所有字段

Stringsql=”selectcount(*)fromtb_userwhereusername=?

andpassword=?

try{

PreparedStatementpst=conn.prepareStatement(sql);

pst.setString(1,user。

getUsername());

pst。

setString(2,user.getPassword());

//执行查询语句,拿到结果集

ResultSetrs=pst.executeQuery();

while(rs.next()){

intcount=rs。

getInt

(1);

//用count和0比较,若大于0表示该用户存在,否则不存在

if(count〉0){

flag=true;

}

}catch(SQLExceptione){

e.printStackTrace();

}

returnflag;

3.LoginServlet,点击登录跳转到服务器端

packagecom.softeem.servlet;

io。

IOException;

importjavax。

servlet.ServletException;

importjavax.servlet。

http.HttpServlet;

servlet.http.HttpServletRequest;

servlet。

http。

HttpServletResponse;

importcom.softeem.dao.UserDAO;

importcom.softeem.dto.User;

/**

*ServletimplementationclassLoginServlet

publicclassLoginServletextendsHttpServlet{

privatestaticfinallongserialVersionUID=1L;

/**

*@seeHttpServlet#HttpServlet()

*/

publicLoginServlet(){

super();

*@seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponseresponse)

protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{

super。

doGet(request,response);

*@seeHttpServlet#doPost(HttpServletRequestrequest,HttpServletResponseresponse)

protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{

//获取表单数据

//处理乱码

request.setCharacterEncoding(”utf—8”);

Stringusername=request.getParameter(”username”);

Stringpassword=request。

getParameter(”password"

);

//封装到user对象中

Useruser=newUser();

user.setUsername(username);

user。

setPassword(password);

//调用dao的checkLogin方法

UserDAOdao=newUserDAO();

booleanflag=dao。

checkLogin(user);

Stringmessage=null;

Stringpath=null;

if(flag){

message="

登录成功"

path="

success.jsp"

request。

getSession().setAttribute(”user”,user);

}else{

message="

对不起密码错误,请重新输入!

path=”fail.jsp”;

//response返回message

response。

setCharacterEncoding(”utf-8"

);

response.getWriter().write(message);

*/

//属于服务器跳转,浏览器地址栏没有发生改变request。

getRequestDispatcher(path).forward(request,response);

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

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2