posts - 0,  comments - 17,  trackbacks - 0
          <%@ page contentType="text/html; charset=GBK" %> 
          <%@ page import="java.util.*" %> 

          <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> 
          <html> 
            
          <head> 
              
          <title>JSTL測(cè)試1--c:forEach循環(huán)</title> 
            
          </head> 

            
          <body> 
          一、整數(shù) 
              
          <c:forEach var="i" begin="1" end="10" step="1"> 
                
          <c:out value="" />
              
          </c:forEach><p>   


          二、計(jì)算x的平方 
             
          <table>  
             
          <tr><th>Value</th>  
              
          <th>Square</th></tr>  
              
          <c:forEach var="x" begin="0" end="10" step="2">  
              
          <tr><td><c:out value=""/></td>  
                  
          <td><c:out value="0"/></td></tr>  
             
          </c:forEach>  
            
          </table> <p> 
          三、字符串
          "47,52,53,55,46,22,16,2" 分隔. 
             
          <table border="1"> 
             
          <c:forTokens items="47,52,53,55,46,22,16,2" delims="," var="dailyPrice"> 
              
          <tr><td><c:out value=""/></td></tr> 
             
          </c:forTokens> 
             
          </table><p> 
          四、使用步長(zhǎng) 
             
          <table>  
              
          <tr><th>second</th>  
              
          <th>second</th></tr>  
              
          <c:forEach var="seconds" begin="0" end="1800" step="60">  
              
          <tr><td><c:out value=""/></td>  
                  
          <td><c:out value=""/></td></tr>  
             
          </c:forEach>  
            
          </table> <p> 
          五、對(duì)數(shù)組進(jìn)行循環(huán)
          <p> 
            
          <% int ai[] = {1020304050}; 
            pageContext.setAttribute(
          "ary", ai); 
            
          %> 
            
          <c:forEach var="i" items=""> 
              
          <c:out value=""/>* 
            
          </c:forEach><p> 

           
          <% 
             Cookie c
          =new Cookie("cookie1","one"); 
             response.addCookie(c); 
           
          %> 

           
          <%  
            Cookie cookies[]
          =request.getCookies();  
            Cookie sCookie
          =null;   
            String sname
          =null;  
            String name
          =null;  
            
          if(cookies==null) // 如果沒(méi)有任何cookie  
              out.
          print("none any cookie");  
            
          else  
            {  
              
          //out.print(cookies.length + "<br>");  
              
          for(int i=0;i<cookies.length; i++// 循環(huán)列出所有可用的Cookie  
              {  
               sCookie
          =cookies[i];  
                sname
          =sCookie.getName();  
                name 
          = sCookie.getValue();  
                out.println(sname 
          + "->" + name + "<br>");  
              }  
            }   
          %>  
            
          <table border="1" align="center">  
             
          <tr><th>Cookie Name</th>  
              
          <th>Cookie Value</th></tr>  
              
          <c:forEach var="cook" items="">  
              
          <tr><td><c:out value=""/></td>  
                  
          <td><c:out value=""/></td></tr>  
             
          </c:forEach>  
            
          </table> <p> 

          六、字符串?dāng)?shù)組循環(huán) 
           
          <% String as[] = { 
                      
          "A first string""La deuxieme string""Ella troisiemo stringo" 
                  }; 
                  request.setAttribute(
          "stringArray", as); 
           
          %><p> 
           
          <c:forEach var="string" items=""> 
            
          <c:out value=""/><br> 
           
          </c:forEach> 
          七、枚舉 
           
          <% 
           Hashtable hashtable1 
          = new Hashtable(); 
                     pageContext.setAttribute(
          "numberMap", hashtable1); 
                
                  hashtable1.put(new Integer(
          1), "uno"); 
                  hashtable1.put(new Integer(
          2), "dos"); 
                  hashtable1.put(new Integer(
          3), "tres"); 
                  hashtable1.put(new Integer(
          4), "cuatro"); 
                  hashtable1.put(new Integer(
          5), "cinco"); 
                  hashtable1.put(new Integer(
          6), "seis"); 
                  hashtable1.put(new Integer(
          7), "siete"); 
                  hashtable1.put(new Integer(
          8), "ocho"); 
                  hashtable1.put(new Integer(
          9), "nueve"); 
                  hashtable1.put(new Integer(
          10), "diez"); 

                  java.util.Enumeration enumeration 
          = hashtable1.keys(); 
                  pageContext.setAttribute(
          "enumeration", enumeration); 
          %> 

             
          <c:forEach var="item" items="" begin="2" end="10" step="2"> 
               
          <c:out value=""/><br> 
             
          </c:forEach><p> 
          八、map
          <p> 
             
          <c:forEach var="prop" items="" begin="1" end="5"> 
               
          <c:out value=""/> = <c:out value=""/><br> 
             
          </c:forEach> 

            

           
          </body> 
          </html> 
          posted on 2008-03-29 21:18 xyz 閱讀(2355) 評(píng)論(0)  編輯  收藏 所屬分類: 網(wǎng)絡(luò)文摘

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          留言簿

          隨筆檔案(1)

          文章分類(44)

          文章檔案(46)

          收藏夾(1)

          Adobe

          AOP

          API

          appServer

          BI

          c

          • c-free
          • codeblocks
          • codelite
          • CodeLite IDE 是一個(gè)強(qiáng)大的開源,跨平臺(tái)的 C/C++整合開發(fā)環(huán)境. 支持包括 Windows、Linux 和 Mac 系統(tǒng)下運(yùn)行
          • codelite官網(wǎng)
          • dev-c++
          • Dev-C++是一個(gè)C&C++開發(fā)工具,它是一款自由軟件,遵守GPL協(xié)議。
          • GCC
          • GCC 原名為 GNU C 語(yǔ)言編譯器(GNU C Compiler),因?yàn)樗局荒芴幚?C語(yǔ)言。GCC 很快地?cái)U(kuò)展,變得可處理 C++。之后也變得可處理 Fortran、Pascal、Objective-C、Java, 以及 Ada 與其他語(yǔ)言。

          Cache

          CMS

          DB

          eclipse

          FreeMarker

          hibernate

          html5

          ibatis

          java

          jquery

          js

          json

          Linux

          Log

          mail server

          mobile

          mysql

          oauth

          openID

          other

          PHP

          portal

          report

          Scheduler

          schema

          Security

          SOA

          spring

          struts

          UI原型設(shè)計(jì)

          w3c

          Wap

          webservice

          xml

          供應(yīng)鏈管理

          博客鏈接

          好網(wǎng)站

          工作流

          開源網(wǎng)

          招聘

          插件下載

          操作系統(tǒng)

          構(gòu)建可伸縮的系統(tǒng)

          構(gòu)建工具

          測(cè)試

          • IETest
          • IE官網(wǎng)
          • OpenSTA
          • Siege
          • Siege是一個(gè)壓力測(cè)試和評(píng)測(cè)工具,設(shè)計(jì)用于WEB開發(fā)這評(píng)估應(yīng)用在壓力下的承受能力

          游戲

          源碼托管

          經(jīng)營(yíng)

          資源

          金融/財(cái)務(wù)

          搜索

          •  

          最新評(píng)論

          主站蜘蛛池模板: 左权县| 临汾市| 页游| 河南省| 新蔡县| 庆安县| 三明市| 呼和浩特市| 磐安县| 留坝县| 青岛市| 遂宁市| 湘潭市| 云阳县| 夏邑县| 平原县| 鄂托克旗| 新乐市| 五莲县| 乐亭县| 南川市| 镇赉县| 广德县| 石河子市| 海晏县| 冕宁县| 海伦市| 松滋市| 阳城县| 阳春市| 舒兰市| 安龙县| 乡宁县| 老河口市| 沙河市| 永春县| 犍为县| 屏山县| 巴青县| 洛扎县| 镇巴县|