display分頁詳細解析例子_第1頁
display分頁詳細解析例子_第2頁
display分頁詳細解析例子_第3頁
display分頁詳細解析例子_第4頁
display分頁詳細解析例子_第5頁
全文預覽已結(jié)束

下載本文檔

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

文檔簡介

1、dispaly 配置1. 引入dispaly架包2. 配置 web.xml3. 頁面jsp, dispaly標簽引入display tag中設(shè)置了很多默認的屬性,它有一個專門的屈性文件,是在它的jar包中的 displaytag/properties/tabletperties想要改變它的默認屬性,我們 nj* 以在web -inf/cl asses 下新建一個文件 di spl ay tag. properties,仿照 tabletag. properties 中屈性的格 式設(shè)置需要修改的屬性。tabletperties中的# messages中設(shè)置的是顯示在頁而上

2、的提示信息。默認是英文的, 我們可以把它改為中文的。不過這里只能使川unicode,就是說屮文字符必須轉(zhuǎn)換為unicode 碼,這個可以使用jdk自帶的native2ascii.exe進彳亍轉(zhuǎn)換。后臺查詢代碼package com.etc.dao.impl;import java.sqlconnection;import java.sql.preparedstateme nt;import java.sql.resultset;import java.ulil.an-aylist;import java.util.list;import com.etc.dao.userdao;import c

3、om.etc.po.departmentlnfo;import com.etc.po.userlnfo;import com.etc.util.dbcon;public list<userinfo> getalluser(string username) system.out.println(mdaon + username);/連接connection con = null;/預編譯preparedstatement pre = null;/結(jié)果集resultset res = null;wherestring sql = "select a.*,b.departmen

4、t_name from user_info a ,department_info b a.department_id = b.department_id h;訐(username != null && !mh.equals(username.trim() sql += n and a.user_name like ? m;system.out.println(sql);/獲取連接con = dbcon.getconnection();/創(chuàng)建實例pre = con.preparestatement(sql);訐(username != null && !mh.eq

5、uals(username.trim() pre.setstring(l, "%" + username +/執(zhí)行sqlres = pre.executequery();/創(chuàng)建集合list<userinfo> list = new array li s t<u se rl n fo>();while (res.next() userinfo user = new userlnfo(); user.setdepartmentid(res.getint(mdepartment_idm); uscr.sctdcpailmcnlnamc(rcs.gctstr

6、ing(hdcpartmcnt_namcn); uscr.sctuscrid(rcs.gctint(uuscr_idm);user.setusername(res.getstring(muser_namem); user.setuserage(res.getint(nuser_agem); user.setusernum(res.getstring(muser_numn); user.setuserpw(res.getstring(muser_pwm);user.setusersex(res.getstring(l,user_sexh);list.add(uscr);return list;

7、catch (exception e) e.printstacktrace(); finally dbconxloseres(res);dbcon.closepre(pre);dbcon.closecon(con);return null;前臺jsp頁面代碼v% page language=hjavan import=mjava.util.*,com.etc.po.*n pageencoding=hutf-8m%><%string path = request.getcontextpath();stringbasepathrequest.getscheme()+n:/n+reque

8、st.getservername()+1,:m+request.getserverport()+path+,7h; %><% taglib prefix="display" uri=h,r%><!doctype html public “-/w3c/dtd html 4.01 transitional/enm><html><head><link rel=hstylesheetm type=mtext/cssn href=u<%=basepath%>css/display.cssn><base

9、 href="<%=basepath%>"><title>my jsp serjist.jsp* starting page</title><meta http-equiv=npragmah content=hno-cacheh><meta http-equiv=hcache-contror, content=, no-cachem><meta http-equiv=nexpiresh content=h0m><meta http-equiv=hkeywordsh content=mkeyw

10、ord 1,keyword2,keyword3m><meta http-equiv=ndescriptionm contentthis is my pageh><script type=htext/j avascript m>function add()只提交到doget方法window.location = m<%=basepath%>servlet/useraddservletm;</script><style ></style></head><bodyxcenter><form a

11、ction=,<%=basepath%>servlet/userqueryservleth method=npostu>名稱:<input type=ntextn name=nusernamen/xinput type=msubmith value二”查詢“/><input type="button" value增加"onclick=madd()'7></form><table align="center" horder="ln width="80%&quo

12、t; class="tab"><tr>vth> 編號 </th>vh> 姓名 </th>vth> 部門 </th><th> 年齡 </th><th> 性別 </th><th> 賬號 </th>vih> 密碼 </lh>vth> 操作 </th></tr><% list<userinfo> list = (list<userinfo>)request.get

13、attribute(muserlistn); if(list!=null && list.size()>0)for(int i=o;i<list.size();i+) userinfo user = list.get(i);%><tr><tdx%=user.getuserid() %></td><tdx%=user.getusername() %></td><tdx%=user.getdepartmentname() %></td><tdx%=user.getuserag

14、e() %x/td><tdx%=user.getusersex() %></td><tdx%=uscr.gctuscrnum() %></td><tdx%=user.getuserpw() %></td><td><ahref="<%=basepath%>servlet/userupdateservlet?userid=<%=user.getuserid() %> ">修改</a><a href="<%=basepat

15、h%>servlet/userdelsendet?userid=<%=user.getuserid() %> ">刪 除</a></td></tr><% else %><tr><td colspan="8" align=hcenter">沒有數(shù)據(jù)! </td></tr><% %></table><display:table name=n$ userlisthpagesize=h4m class=utabn export二me"requesturi=nservlet/userqueryservletm ><display:column property=museridm title=u 編 號" url=,7seitlet/userupdateservleth paramid=huserldm /><display:column property=husernameh title'姓名"/><

溫馨提示

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

最新文檔

評論

0/150

提交評論