• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::

            JSTL 1.2.x is the latest version of JSTL. There are a few differences between this version and the previous JSTL 1.1.x version. The most important difference is that JSTL 1.2.x supports Unified EL (Expression Language) , where as JSTL 1.1.x supports only traditional EL. With Unified EL it becomes very easy to combine the EL in JSF (Java Server Faces) and the EL in JSTL. This guide shows you how to install JSTL 1.2.x properly or troubleshoot your existing JSTL installation. (from: http://hi.baidu.com/kelly_zsl/blog/item/e004562e4f3363331f3089a0.html)


            1. 需要的jar包: jstl-1.2.jar

            2. 復制此jstl-1.2.jar到Web工程的WEB-INFO/lib目錄,不需要任何其他的配置,就可以在JSP頁面中使用jstl了.

            3. 示例: 在頁面中輸出 1 到 10

            <%@ page language="java" contentType="text/html; charset=UTF-8"

            pageEncoding="ISO-8859-1"%>

            <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


            <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

            <html>

            <head>

            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

            <title>Insert title here</title>

            </head>

            <body>

            <c:forEach var="i" begin="1" end="10" step="1">

            <c:out value="${i}" />

            </c:forEach>

            </body>


            EL只操作屬性,所操作的類應該是JavaBean規范的,所操作的屬性要有getter, setter.

            ${user.username}: 默認是從request(page)中取,如果request中沒有名為username的對象則從session中取,session中沒有則從application(servletContext)中取,如果沒有取到任何值則不顯示。

            </html>


            訪問ArrayList的方式:

            1. 放入request.setAttribute()或者session.setAttriute(),然后items="${users}"

            <table border=1>

            <tr>

            <td>用戶名</td><td>密碼</td>

            </tr>

            <c:forEach var="users" items="${users}">

            <tr>

            <td><c:out value="${users.username}" /></td>

            <td><c:out value="${users.password}" /></td>

            </tr>

            </c:forEach>

            </table>


            2. 使用JSP的賦值表達式 items="<%= users %>",這種方式也可以訪問數組

            <table border=1>

                <tr>

                    <td>用戶名</td><td>密碼</td>

                </tr>

                <c:forEach var="users" items="<%= users %>">

                    <tr>

                        <td><c:out value="${users.username}" /></td>

                        <td><c:out value="${users.password}" /></td>

                    </tr>

                </c:forEach>

            </table>

            學習示例: http://www.java2s.com/Tutorial/Java/0380__JSTL/Catalog0380__JSTL.htm


            posted on 2010-12-22 18:13 逛奔的蝸牛 閱讀(553) 評論(0)  編輯 收藏 引用 所屬分類: Java
            久久99精品久久久久久| 久久久久久亚洲精品无码| 香蕉久久夜色精品国产2020| 久久国产精品久久| 久久香蕉国产线看观看99| 久久国产三级无码一区二区| 香蕉久久夜色精品国产2020| 久久亚洲AV成人无码国产| 国产精品欧美久久久久天天影视| 亚洲国产香蕉人人爽成AV片久久 | 久久精品国产亚洲麻豆| 99久久精品国产综合一区| 日韩久久无码免费毛片软件| 久久天天躁狠狠躁夜夜avapp| 久久电影网一区| 伊人色综合久久天天人手人婷 | 美女写真久久影院| 99精品国产免费久久久久久下载| 久久超乳爆乳中文字幕| 久久这里都是精品| 国产女人aaa级久久久级| 久久精品九九亚洲精品| 久久综合偷偷噜噜噜色| 国产精品欧美久久久久无广告| 亚洲中文字幕久久精品无码喷水| 欧美亚洲日本久久精品| 亚洲国产精久久久久久久| 91精品国产色综合久久| 久久99国产综合精品免费| 99久久精品免费看国产一区二区三区 | 欧美色综合久久久久久| 99久久夜色精品国产网站| 99久久无码一区人妻a黑| 伊人久久大香线蕉亚洲五月天| 久久中文字幕无码专区| 91精品国产91久久| 国产成人综合久久久久久| 欧美伊香蕉久久综合类网站| 狠狠狠色丁香婷婷综合久久俺| 97精品伊人久久大香线蕉app| 久久精品国产亚洲av影院|