Dict.CN 在線詞典, 英語學習, 在線翻譯

          都市淘沙者

          荔枝FM Everyone can be host

          統計

          留言簿(23)

          積分與排名

          優秀學習網站

          友情連接

          閱讀排行榜

          評論排行榜

          編寫純HTMLjsp應用--學會使用JSTL(轉)

          ? 先來搭下環境,jstl的包當然是不能少的拉。其次,下載必須的標簽庫或者是java的標簽庫文件。沒有的話,也可以聯系我 xxx_programer@163.com?
          ???? 將jstl 1.1.jar加到class中,(這就不要我詳細的講了吧),然后將標簽庫放到WEB-INF下或則將java的標簽庫文件(*.jar)放到WEB-INF\lib下,就可以寫測試代碼了。
          ???? first_jstl.jsp

          ???? <%@ taglib prefix="c" uri="??? <%@ page contentType="text/html; charset=gb2312" language="java" %>
          ??? <c:set var="userName" value="hellking"/>
          ??? <c:set value="16" var="age"/>
          ??? 歡迎您,<c:out value="${userName}"/><hr>
          ?? <c:forEach var="i" begin="1" end="5">
          ?? <font size=${i}>${i}</font>
          ?? <br>
          ?? </c:forEach>

          ?? <c:if test="${age<18}">
          ?? ?對不起,你的年齡過小,不能訪問這個網頁◎!
          ?? </c:if>
          ?? <br>
          ?? </body>
          ?? </html>

          ??? web.xml
          (使用java的標簽庫文件*.jar)
          ??
          ??? <?xml version="1.0" encoding="ISO-8859-1"?>

          <web-app xmlns="??? xmlns:xsi="??? xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
          ??? version="2.4">
          ? <display-name>jstl test</display-name>
          ? <description>
          ???? jstl test
          ? </description>
          </web-app>

          (使用標簽庫文件*.tld)

          ? <?xml version="1.0" encoding="ISO-8859-1"?>

          <web-app xmlns="??? xmlns:xsi="??? xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee??? version="2.4">
          ?
          ? <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
          ??? <taglib-location>/WEB-INF/fmt.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
          ??? <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
          ??? <taglib-location>/WEB-INF/c.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
          ??? <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
          ??? <taglib-location>/WEB-INF/sql.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
          ??? <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
          ??? <taglib-location>/WEB-INF/x.tld</taglib-location>
          </taglib>

          <taglib>
          ??? <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
          ??? <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
          </taglib>
          </web-app>

          好了,一個最簡單的包含有jstl的頁面設計完成了。下面測試。
          http://localhost:8080/jstl/frist_jstl.jsp
          頁面輸出結果:

          歡迎您,hellking


          1
          2
          3
          4
          5
          對不起,你的年齡過小,不能訪問這個網頁◎!

          呵呵。。。簡單吧,下篇繼續。。。。。:)

          ?


          引用地址:http://blog.programfan.com/trackback.asp?id=16965

          posted on 2006-09-30 16:21 都市淘沙者 閱讀(1354) 評論(0)  編輯  收藏 所屬分類: JSP/PHP

          主站蜘蛛池模板: 青州市| 龙泉市| 河池市| 泌阳县| 苏州市| 渭源县| 桦甸市| 广东省| 定州市| 保德县| 祁阳县| 东宁县| 于都县| 西和县| 两当县| 万山特区| 邮箱| 祁门县| 宜丰县| 新昌县| 江源县| 赣榆县| 宿松县| 喀喇| 墨竹工卡县| 屏边| 原平市| 天柱县| 漯河市| 寿阳县| 通山县| 正蓝旗| 祥云县| 额济纳旗| 兴安县| 曲靖市| 武强县| 郧西县| 泗水县| 潼关县| 朔州市|