版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
JavaStrutsNETCTOSS資費的分頁顯OGNL基本語ValueStack結重構NETCTOSS資費列表顯示(分頁版
圖-圖-
圖-圖-在你的myeclipse點中struts02_1工程,右鍵Properties,找到MyEclipse下的Web,顯示內如圖-5所示。找到webContext-root可以看到文本框中的名字還是struts01_2,而我們當前的工程名為struts02_1,所以修改webContext-root為struts02_1,這樣部署到tomcat下的工程名和myeclipse圖-packagepackageprivatestaticfinalStringfindAll"selectID,NAME,BASE_DURATION,BASE_COST,UNIT_COST,CREATIME,ST"selectrownumr,ID,NAME,BASE_DURATION,BASE_COST,UNIT_COST"wherea.r>?privatestaticfinalStringgetTotalPages="selectcount(*)fromCOST";
圖-classFeeDAOpublicintgetTotalPages(intpageSize)Connectioncon=PreparedStatementstmt=ResultSetrs=trycon=stmt=rs=inttotalRows=if(totalRows%pageSize==0)returntotalRows/}elsereturntotalRows/pageSize+}}catch(Exceptione)thrownew}finally{}}publicList<Fee>findAll(intpage,int{Connectioncon=PreparedStatementstmt=ResultSetrs=trycon=stmt=intbegin=(intend=stmt.setInt(1,stmt.setInt(2,rs=List<Fee>list=newwhile(rs.next())Feefee=new return}catch(Exceptione)thrownew}finally{}}}修改publicclassFeeListActionprivateprivateprivateList<Fee>feeList=intpage=1;inttotalPages;publicintgetTotalPages()return} publicvoidsetTotalPages(inttotalPages)
this.totalPages=}publicStringFeeDAOfeeDAO=newFeeDAO();feeList=feeDAO.findAll(page,3);totalPages=feeDAO.getTotalPages(3);return"success";}publicint{return}publicvoidsetPage(int{this.page=}publicList<Fee>{return}publicvoidsetFeeList(List<Fee>{this.feeList=}}修改<%@pagelanguage="java"pageEncoding="UTF-<%@taglib/jsp/jstl/core"<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN".<html<metahttp-equiv="Content-Type"content="text/html;charset=utf-<linktype="text/css"rel="stylesheet"media="all"<linktype="text/css"rel="stylesheet"media="all"<!--Logo<div<imgsrc="../images/logo.png"alt="logo"<ahref="#">[<!--Logo<!--導航區(qū)域開始--><div<ul <li><ahref="../index.html"<li><ahref="../role/role_list.html"<li><ahref="../admin/admin_list.html"<li><ahref="../fee/fee_list.html"<li><ahref="../account/account_list.html"<li><ahref="../service/service_list.html"<li><ahref="../bill/bill_list.html"<li><ahref="../report/report_list.html"<li><ahref="../user/user_info.html"<li><ahref="../user/user_modi_pwd.html"<!--導航區(qū)域結束--><!--主要區(qū)域開始--><div<formaction=""<!--排序--><div<inputtype="button"value="月租"<inputtype="button"value="基費"<inputtype="button"value="時長"<inputtype="button"value="增加"class="btn_add"<divid="operate_result_info"<imgsrc="../images/close.png"<div<table<th>資費<thclass="width100">資費名稱<th>基本時長<th>基本費用<th>單位費用<th>創(chuàng)建時間<th>開通時間<thclass="width50">狀態(tài)<th<c:forEachitems="${feeList}"<td>${fee.baseDuration}小時<td>${fee.baseCost}元<td>${fee.unitCost}元/小時<c:iftest="${fee.status==0}"<c:iftest="${fee.status==1}"<c:iftest="${fee.status==2}"<c:iftest="${fee.status!=0&&<inputtype="button"value=c<inputtype="button"value=c<inputtype="button"value=c<p>業(yè)務說明:<br/>1、創(chuàng)建資費時,狀態(tài)為暫停,記載創(chuàng)建時間;<br/>2、暫停狀態(tài)下,可修改,可刪除;<br/>34<!--分頁--><div<c:whentest="${page><ahref="feeList.action?page=${1}"><c:forEachvar="p"begin="1"end="${totalPages}"><c:whentest="${page==<ahref="feeList.action?page=${p}"<ahref="feeList.action?page=${p}">${p<c:whentest="${page<<ahref="feeList.action?page=${page+1}<!--主要區(qū)域結束--><div<p>[源自的技術,最優(yōu)秀的師資,最真實的企業(yè)環(huán)境,最適用的<p>(C)達內IT培訓公司,如圖-6圖-packageclassFeeDAOprivatestaticfinalStringfindAll"selectID,NAME,BASE_DURATION,BASE_COST,UNIT_COST,CREATIME,"selectrownumr,ID,NAME,BASE_DURATION,BASE_COST,"wherea.r>?privatestaticfinalStringgetTotalPages"selectcount(*)fromCOST";publicintgetTotalPages(intpageSize)Connectioncon=PreparedStatementstmt=ResultSetrs=trycon=stmt=rs=inttotalRows=if(totalRows%pageSize==0)returntotalRows/}elsereturntotalRows/pageSize+}}catch(Exceptione)thrownew}finally{ publicList<Fee>findAll(intpage,intpageSize)Connectioncon=PreparedStatementstmt=ResultSetrs=trycon=stmt=intbegin=(intend=stmt.setInt(1,stmt.setInt(2,rs=List<Fee>list=newwhile(rs.next())Feefee=new return}catch(Exceptione)thrownew}finally{ }publicclassFeeListActionprivateList<Fee>feeList=privateintpage=privateinttotalPages;publicintgetTotalPages()return publicvoidsetTotalPages(inttotalPages)this.totalPages= publicStringFeeDAOfeeDAO=newfeeList=totalPages=return publicintgetPage()return publicvoidsetPage(intpage)this.page= publicList<Fee>getFeeList()return publicvoidsetFeeList(List<Fee>feeList)this.feeList=}}<%@pagelanguage="java"pageEncoding="UTF-<%@taglib /jsp/jstl/core"<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN" <html <metahttp-equiv="Content-Type"content="text/html;charset=utf-<linktype="text/css"rel="stylesheet"media="all"<linktype="text/css"rel="stylesheet"media="all"<!--Logo<div<imgsrc="../images/logo.png"alt="logo"<ahref="#">[<!--Logo<!--導航區(qū)域開始--><div<ul <li><ahref="../index.html"<li><ahref="../role/role_list.html"<li><ahref="../admin/admin_list.html"<li><ahref="../fee/fee_list.html"<li><ahref="../account/account_list.html"<li><ahref="../service/service_list.html"<li><ahref="../bill/bill_list.html"<li><ahref="../report/report_list.html"<li><ahref="../user/user_info.html"<li><ahref="../user/user_modi_pwd.html"<!--導航區(qū)域結束--><!--主要區(qū)域開始--><div<formaction=""<!--排序--><div<inputvalue="<inputvalue="<inputvalue=" <inputtype="button"value="增加"class="btn_add" <divid="operate_result_info" <imgsrc="../images/close.png" <div <table <th>資費 <thclass="width100" <thclass="width50 <th <c:forEachitems="${feeList}" <td>${fee.baseDuration} <td>${fee.baseCost}元</ <td>${fee.unitCost}元/小時</<c:iftest="${fee.status==0}"<c:iftest="${fee.status==1}"<c:iftest="${fee.status==2}"<c:iftest="${fee.status!=0&&<inputtype="button"value=c<inputtype="button"value=c<inputtype="button"value=c<p>業(yè)務說明:<br/>1、創(chuàng)建資費時,狀態(tài)為暫停,記載創(chuàng)建時間;<br/>2、暫停狀態(tài)下,可修改,可刪除;<br/>34<!--分頁--><div<c:whentest="${page><ahref="feeList.action?page=${1}">上一頁<c:forEachvar="p"begin="1"<c:whentest="${page==<ahref="feeList.action?page=${p}"<ahref="feeList.action?page=${p}">${p<c:whentest="${page<<ahref="feeList.action?page=${page+1}<!--主要區(qū)域結束--><div<p>[源 公司1.4擴展。IntegergetId(){returnvoidsetId(Integerid){this.id=StringgetName(){returnvoidsetName(Stringname){=String[]getArry(){returnvoidsetArry(String[]arry){this.arry=List<String>getList(){returnvoidsetList(List<String>list){this.list=Map<String,String>getMap(){returnvoidsetMap(Map<String,String>map){this.map=}publicclassFooprivateprivateIntegerStringprivateString[]privateList<String>list;privateMap<String,String>map;3.新建類TestOgnl01.java,演示基本類型屬性,數組、List屬性,MappublicclassTestOgnl01publicstaticvoidmain(String[]args)throws{Foofoo=newfoo.setArry(newString[]{"one","two","three"foo.setList(Arrays.asList("A","B","C"));HashMap<String,String>map=newHashMap<String,map.put("one",map.put("two",map.put("three",/*Ognl引 *Ognl.getValue("OGNL表達式",root對象);//root對象是Ognl//1.基本類型屬性(包括System.out.println(Ognl.getValue("id",System.out.println(Ognl.getValue("name",//2.數組、List //3.Map System.out.println(Ognl.getValue("map['two']",//4.System.out.println(Ognl.getValue("id+100",System.out.println(Ognl.getValue("\"Whatis\"+name",System.out.println(Ognl.getValue("\"name:\"+name+\"id:\"System.out.println(Ognl.getValue("id>150",//5. System.out.println(Ognl.getValue("list.size()", Ognl.getValue("map['three'].lastIndexOf(name)",//6.//7.創(chuàng)建的ListObjectobj=Ognl.getValue("{1,2,3,4,5}",//8.創(chuàng)建的Mapobj="#{1:'java',2:'javajava',3:'javajavajava'}", 新建
圖-publicclassBarprivateStringpublicStringgetName(){returnpublicvoidsetName(Stringname){=}publicclassTestOgnl02publicstaticvoidmain(String[]args)throwsExceptionMap<String,Object>ctxnewHashMap<StringObject>();ctx.put("num",10);//rootBarroot=new}}圖-publicclassFooprivateprivateprivateprivateprivateIntegerStringname;String[]arry;List<String>list;Map<String,String>publicIntegergetId(){returnpublicvoidsetId(Integerid){this.id=id;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){=name;}publicString[]getArry(){returnarry;}publicvoidsetArry(String[]arry){this.arry=arry;}publicList<String>getList(){returnlist;}publicvoidsetList(List<String>list){this.list=publicMap<String,String>getMap(){return publicvoidsetMap(Map<String,String>map){this.map=}}publicclassTestOgnl01publicstaticvoidmain(String[]args)throwsExceptionFoofoo=newFoo();foo.setArry(newString[]{"one","two","three"foo.setList(Arrays.asList("A","B",HashMap<String,String>mapnewHashMap<String,map.put("one",map.put("two",map.put("three",/*Ognl引 *Ognl.getValue("OGNL表達式",root對象);//root對象是Ognl//1.基本類型屬性(包括System.out.println(Ognl.getValue("id",System.out.println(Ognl.getValue("name",//2.數組、List//3.Map System.out.println(Ognl.getValue("map['two']",//4.System.out.println(Ognl.getValue("\"Whatis\"+name",System.out.println(Ognl.getValue("\"name:\"+name+\"id:\"System.out.println(Ognl.getValue("id>150",//5.System.out.println(Ognl.getValue("name.toUpperCase()",System.out.println(Ognl.getValue("list.size()",Ognl.getValue("map['three'].lastIndexOf(name)",//6.//7.創(chuàng)建的ListObjectobj=Ognl.getValue("{1,2,3,4,5}",//8.創(chuàng)建的Mapobj="#{1:'java',2:'javajava',3:'javajavajava'}","#{1:'java',2:'javajava',3:'javajavajava'}",}}publicclassBarprivateStringpublicStringgetName(){returnpublicvoidsetName(Stringname){=}} publicclassTestOgnl02publicstaticvoidmain(String[]args)throwsExceptionMap<String,Object>ctxnewHashMap<String,Object>();ctx.put("num",10);//rootBarroot=newBar();準備好Struts2開發(fā)環(huán)境a.新建web工程struts02_3packagepublicclassDebugActionprivateprivateprivateStringintid;String[]arry;publicStringexecute()name="java";id=100;return}publicintgetId(){returnpublicvoidsetId(intid){this.id=publicStringgetName(){returnpublicvoidsetName(Stringname){=}新建<?xmlversion="1.0"encoding="UTF-<!DOCTYPEstruts"-//ApacheSoftwareFoundation//DTDStrutsConfiguration"<packagename="valuestack"extends="struts-<actionname="debug"<resultname="success">/WEB-<%@pagepageEncoding="utf-<%@pageimport="java.util.*" Enumerationen= ement()+}//打印出Objectobj=request.getAttribute("struts.valueStack");out.println("<hr/>struts.valueStack對象:<br/>"+
圖-修改<%@pagepageEncoding="utf-<%@tagliburi="/struts-tags"Objectobj=<!--<s:debug8.,點擊[debug],顯示內容如圖-圖-通用的標記<s:propertyvalue=""/>Struts2自己定義的標記庫,用于valueStack,修<%@pagepageEncoding="utf-<%@tagliburi="/struts-tags"<!--struts2<s:propertyvalue=""/>標記通過OGNL--<h2><s:propertyvalue="name"/><h2><s:propertyvalue="id"<h2><s:propertypackagepublicclassDebugActionprivateprivateprivateStringintid;String[]arry;}publicintgetId(){returnpublicvoidsetId(intid){this.id=publicStringgetName(){returnpublicvoidsetName(Stringname){=name;}publicString[]getArry(){returnarry;}publicvoidsetArry(String[]arry){this.arry=}
圖-publicString{name=id=arry=new{"spring"return修改<%@pagepageEncoding="utf-<%@tagliburi="/struts-tags"<s:propertyvalue="name+'java'"<s:propertyvalue="arry[1].toUpperCase()",結果如圖-12所示圖-publicclassDebugActionprivateprivateprivateStringintid;String[]arry;publicStringexecute()name="java";id=100;arry=newString[]"spring"};return}publicintgetId(){returnpublicvoidsetId(intid){this.id=publicStringgetName(){returnpublicvoidsetName(Stringname){=name;}publicString[]getArry(){returnarry;}publicvoidsetArry(String[]arry){this.arry=}<?xmlversion="1.0"encoding="UTF-<!DOCTYPEstruts"-//ApacheSoftwareFoundation//DTDStrutsConfiguration"<packagename="valuestack"extends="struts-<actionname="debug"<resultname="success">/WEB-</package><%@pagepageEncoding="utf-<%@tagliburi="/struts-tags"prefix="s"%> Objectobj= <!-- <s:debug<!--struts2通過標記 <s:propertyvalue=""/>標記通過OGNL表達 --<h2><s:propertyvalue="name"/></h2><h2><s:propertyvalue="id"<!--可在value屬性內做字符串拼接<s:propertyvalue="name+'java'"<!--可調用方法<s:propertyvalue="arry[1].toUpperCase()"a.<s:iteratorvalue=”ognl”>將onl指定的集合屬性循環(huán)迭代,在迭代中,將會當前元素壓入o棧頂位置,因此使用”屬性”格式nl,此時定位的是元素屬性,而不是ion屬性。Iar循環(huán)結束后,ain對象又恢復成棧頂,a變量在on區(qū)域,需要使用”變量”<%@pagelanguage="java"pageEncoding="UTF-<%@tagliburi="/struts-tags"<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN" <html <metahttp-equiv="Content-Type"content="text/html;charset=utf-<linktype="text/css"rel="stylesheet"media="all"<linktype="text/css"rel="stylesheet"media="all"<!--Logo<div<imgsrc="../images/logo.png"alt="logo"<ahref="#">[<!--Logo<!--導航區(qū)域開始--><div<ul <li><ahref="../index.html"<li><ahref="../role/role_list.html"<li><ahref="../admin/admin_list.html"<li><ahref="../fee/fee_list.html"<li><ahref="../account/account_list.html"<li><ahref="../service/service_list.html"<li><ahref="../bill/bill_list.html"<li><ahref="../report/report_list.html"<li><ahref="../user/user_info.html"<li><ahref="../user/user_modi_pwd.html"<!--導航區(qū)域結束--><!--主要區(qū)域開始--><div<formaction=""<!--排序--><div<inputtype="button"value="月租"<inputtype="button"value="基費"<inputtype="button"value="時長"<inputtype="button"value="增加"class="btn_add"<divid="operate_result_info"<imgsrc="../images/close.png"<div<table<th>資費<thclass="width100">資費名稱<th>基本時長<th>基本費用<th>單位費用<th>創(chuàng)建時間<th>開通時間<thclass="width50">狀態(tài)<th<s:iterator<td><s:propertyvalue="id"<td><s:propertyvalue="feeName"<td><s:propertyvalue="baseDuration"<td><s:propertyvalue="baseCost"<td><s:propertyvalue="unitCost"<td><s:propertyvalue="createTime"<td><s:propertyvalue="startTime"<s:iftest="status==0"><s:iftest="status==1"><s:iftest="status==2"><s:iftest="status!=0&&status!=<inputtype="button"value="啟用"<inputtype="button"value="修改"<inputtype="button"value="刪除"<p>業(yè)務說明:<br/>1、創(chuàng)建資費時,狀態(tài)為暫停,記載創(chuàng)建時間;<br/>2、暫停狀態(tài)下,可修改,可刪除;<br/>34<!--分頁--><div<s:iftest="page><ahref="feeList.action?page=${1}">上一頁</<s:iteratorvalue="newint[totalPages]"<s:iftest="#i.count==<ahref='feeList.action?page=<s:property<ahref='feeList.action?page=<s:property<s:iftest="page<<ahref="feeList.action?page=${page+1}">下一頁</<!--主要區(qū)域結束--><div<p>[源 公司<%@pagelanguage="java"pageEncoding="UTF-<%@tagliburi="/struts-tags"<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN".<html<metahttp-equiv="Content-Type"content="text/html;charset=utf-<linktype="text/css"rel="stylesheet"media="all"<linktype="text/css"rel="stylesheet"media="all"<!--Logo<div<imgsrc="../images/logo.png"alt="logo"<a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030全球新能源電池CCS集成母排行業(yè)調研及趨勢分析報告
- 2025-2030全球無線藍牙肉類溫度計行業(yè)調研及趨勢分析報告
- 2025-2030全球血栓彈力圖檢測試劑盒行業(yè)調研及趨勢分析報告
- 2025-2030全球核電站管道系統行業(yè)調研及趨勢分析報告
- 2025-2030全球環(huán)氧干式變壓器行業(yè)調研及趨勢分析報告
- 2025年全球及中國超聲軟組織手術刀行業(yè)頭部企業(yè)市場占有率及排名調研報告
- 2025年全球及中國一次性3D儲液袋行業(yè)頭部企業(yè)市場占有率及排名調研報告
- 2025-2030全球聚氨酯泡沫開孔劑行業(yè)調研及趨勢分析報告
- 2025年全球及中國家具彈性帶行業(yè)頭部企業(yè)市場占有率及排名調研報告
- 2025【合同范本】服裝專賣店加盟合同
- 2024年湖南高速鐵路職業(yè)技術學院高職單招數學歷年參考題庫含答案解析
- 上海鐵路局招聘筆試沖刺題2025
- 國旗班指揮刀訓練動作要領
- 春季安全開學第一課
- 植物芳香油的提取 植物有效成分的提取教學課件
- 肖像繪畫市場發(fā)展現狀調查及供需格局分析預測報告
- 2021-2022學年遼寧省重點高中協作校高一上學期期末語文試題
- 同等學力英語申碩考試詞匯(第六版大綱)電子版
- 墓地個人協議合同模板
- 2024年部編版初中語文各年級教師用書七年級(上冊)
- 中日合同范本
評論
0/150
提交評論