Jsp學(xué)生信息管理系統(tǒng)登錄驗(yàn)證全代碼_第1頁
Jsp學(xué)生信息管理系統(tǒng)登錄驗(yàn)證全代碼_第2頁
Jsp學(xué)生信息管理系統(tǒng)登錄驗(yàn)證全代碼_第3頁
Jsp學(xué)生信息管理系統(tǒng)登錄驗(yàn)證全代碼_第4頁
Jsp學(xué)生信息管理系統(tǒng)登錄驗(yàn)證全代碼_第5頁
已閱讀5頁,還剩11頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、imer);theTimer=setTimeout(turnPage(),speed);checkimer);theTimer=setTimeout(turnPage(),speed);check1.jsp登錄界面Login.jspvtitle用戶登錄界面/titlevformaction=LoginServletmethod=postvbodybgcolor=bluevmarqueedirection=rightonmouseover=stop()onmouseout=start()style=font-family:楷體_GB2312vpvfontsize=10pxcolor=red學(xué)生信

2、息信息管理系統(tǒng)v/fontv/pv/marqueevtablealign=centerwidth=237vtrvtdvtablewidth=100%vtrimer);theTimer=setTimeout(turnPage(),speed);checkimer);theTimer=setTimeout(turnPage(),speed);checkv/divv/trvtrvtdalign=centerSTYLE=cursor:handvfontsize=2vdivclass=b2bbuttonid=bt0onclick=javascript:showPage(0);clearTimeout(t

3、heTimer);theTimer=setTimeout(turnPage(),speed);checkBt();1v/divv/fontv/tdvtdalign=centerSTYLE=cursor:handvfontsize=2vdivclass=b2bbuttonid=bt1onclick=javascript:showPage(1);clearTimeout(theTBt();23v/divvtdalign=centerSTYLE=cursor:handvfontsize=2vdivclass=b2bbuttonid=bt3onclick=javascript:showPage(3);

4、clearTimeout(theTimer);theTimer=setTimeout(turnPage(),speed);checkBt();4v/divv/fontv/tdvtdalign=centerSTYLE=cursor:handvfontsize=2vdivclass=b2bbuttonid=bt4onclick=javascript:showPage(4);clearTimeout(theTonclick=javascript:showPage(4);clearTimeout(theTonclick=javascript:showPage(4);clearTimeout(theTo

5、nclick=javascript:showPage(4);clearTimeout(theTimer);theTimer=setTimeout(turnPage(),speed);checkBt();5v/divvtdalign=centerSTYLE=cursor:handvfontsize=2vdivclass=b2bbuttonid=bt5onclick=javascript:showPage(5);clearTimeout(theTimer);theTimer=setTimeout(turnPage(),speed);checkBt();6v/divv/fontv/tdv/trv/t

6、ablevscriptlanguage=javascriptb2bStr=newArray();b2bStr0=vdivstyle=float:left;width:100%;overflow:hidden;vahref=1giftarget=_blankvimgsrc=1gifwidth=214pxheight=145pxborder=0v/avbrvatarget=_blanktitle=太陽島公園一角href=1gif太陽島公園一角v/av/div;b2bStr1=太陽島公園湖光山色;b2bStr2=哈爾濱雪雕v/div;b2bStr3=vahref=4.giftarget=_blank

7、vimgsrc=4.gifwidth=214pxheight=145pxborder=0v/avbrvatarget=_blanktitle=鏡泊湖href=4.gif鏡泊湖v/av/div;b2bStr4=vdivstyle=float:left;width:100%;overflow:hidden;vahref=5.giftarget=_blankvimgsrc=5.gifwidth=214pxheight=145pxborder=0v/avbrvatarget=_blanktitle=太陽島公園瀑布href=5.gif太陽島公園瀑布v/av/div;b2bStr5=鏡泊湖夜色v/div;

8、varpage=0;varspeed=3000;functionshowPage(id)page=id;setTransition();b2bContentinnerHTML=b2bStrid;b2bContentfiltersrevealTransplay();functionturnPage()showPage(page);theTimer=setTimeout(turnPage(),speed);checkBt();page+;if(page=6)page=0;functioncheckBt()for(vari=0;i6;i+)btObj=eval(bt+i);if(page=i)btO

9、bj.stylecolor=#FFFFFF;btObj.style.backgroundColor=#FF781C;elsebtObj.style.color=#000000;btObj.style.backgroundColor=#F7F7F7;functionsetTransition()b2bContent.filters.revealTrans.Transition=Math.round(Math.random()*23);b2bContent.filters.revealTrans.apply();turnPage();用戶名:密碼:vinputtype=resetvalue=取消v

10、/trv/tablev/formv/bodyv/html2.java代碼(1)User.Java定義的屬性和數(shù)據(jù)庫中的字段相對應(yīng)packagecom.softeem.dt;publicclassUserprivateintid;privateStringusername;privateStringpassword;privateStringxh;privateStringcollege;publicintgetId()returnid;publicvoidsetId(intid)this.id=id;publicStringgetUsername()returnusername;publicv

11、oidsetUsername(Stringusername)this.username=username;publicStringgetPassword()returnpassword;publicvoidsetPassword(Stringpassword)this.password=password;publicStringgetXh()returnxh;publicvoidsetXh(Stringxh)this.xh=xh;publicStringgetCollege()returncollege;publicvoidsetCollege(Stringcollege)this.colle

12、ge=college;(2)UserDA0java操作數(shù)據(jù)庫tb_user,驗(yàn)證用戶登錄packagecom.softeem.dao;importjavasqlConnection;importjava.sql.PreparedStatement;importjava.sql.ResultSet;importjava.sql.SQLException;importcom.softeem.db.DBManager;importcom.softeem.dt.User;publicclassUserDAO/*驗(yàn)證用戶登錄*return*/publicbooleancheckDenglu(Userus

13、er)booleanflag=false;/獲得數(shù)據(jù)庫連接Connectionconn=DBManager.getConnection();/用select*from查詢數(shù)據(jù)庫中的所有字段Stringsql=selectcount(*)fromtb_userwhereusername=?andpassword=?;tryPreparedStatementpst=conn.prepareStatement(sql);pst.setString(1,user.getUsername();pst.setString(2,user.getPassword();/執(zhí)行查詢語句,拿到結(jié)果集ResultSe

14、trs=pst.executeQuery();while(rs.next()intcount=rs.getInt(1);用count和0比較,若大于0表示該用戶存在,否則不存在if(count0)flag=true;catch(SQLExceptione)e.printStackTrace();returnflag;3.LoginServlet,點(diǎn)擊登錄跳轉(zhuǎn)到服務(wù)器端packagecom.softeem.servlet;importjava.io.IOException;importjavax.servlet.ServletException;importjavax.servlet. HYPE

15、RLINK http:/http.HttpServlethttp.HttpServlet;importjavax.servlet. HYPERLINK http:/http.HttpServletRequesthttp.HttpServletRequest;importjavax.servlet. HYPERLINK http:/http.HttpServletResponsehttp.HttpServletResponse;importcom.softeem.dao.UserDAO;importcom.softeem.dto.User;/*Servletimplementationclass

16、LoginServlet*/publicclassLoginServletextendsHttpServletprivatestaticfinallongserialVersionUID=1L;/*seeHttpServlet#HttpServlet()*/publicLoginServlet()super();/*seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponseresponse)protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponsere

17、sponse)throwsServletException,IOExceptionsuper.doGet(request,response);/*seeHttpServlet#doPost(HttpServletRequestrequest,HttpServletResponseresponse)*/protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException/獲取表單數(shù)據(jù)/處理亂碼request.setCharacterEncoding(

18、utf-8);Stringusernamerequest.getParameter(username);Stringpasswordrequest.getParameter(password);/封裝到user對象中Useruser=newUser();user.setUsername(username);user.setPassword(password);/調(diào)用dao的checkLogin方法UserDAOdao=newUserDAO();booleanflag=dao.checkLogin(user);Stringmessage=null;Stringpath=null;if(flag)messag

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論