<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    kooyee ‘s blog

    開源軟件, 眾人努力的結晶, 全人類的共同財富
    posts - 103, comments - 55, trackbacks - 0, articles - 66
       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    『JSP』jsp 標簽taglib不起作用的問題

    Posted on 2008-05-30 22:32 kooyee 閱讀(2866) 評論(2)  編輯  收藏 所屬分類: J2EE
    JSTL <c:out value="${EL}">不能正確輸出的問題

    由于Jsp2.0向后兼容的特性, 當遇到使用Jsp 1.2(Servlet v2.3)的網站時會默認的禁用JSP2.0 EL,所以導致c:out不能正確輸出。
    (這里注意Jsp 1.2禁用JSP2.0的EL,而是去使用JSTL 1.0 taglib去解析EL。所以使用JSP 1.2+JSTL 1.0不會出問題,而使用了JSP 1.2+JSTL 1.1就會導致c:out不能正確輸出)

    啟用EL或修改webv.xml為jsp2.0可以解決問題。



    啟用EL:在jsp頁面中加入
    <%@ page isELIgnored="false"%>

    page指令的isELIgnored屬性是控制EL的使用權的,它的兩個值,true和false
    如果 isELIgnored='true'表示禁用EL,isELIgnored='false' 表示可以使用EL, 默認是false



    修改webv.xml為jsp2.0

    為了用EL改為 








    參考:
    JSTL 1.0 requires JSP 1.2 (J2EE 1.3 platform). The key difference between JSTL 1.0 and JSTL 1.1 is that the expression language (EL) has moved from the JSTL specification to the JSP specification. The EL is therefore now part of the JSP 2.0 specification, and JSTL 1.1 requires JSP 2.0 (J2EE 1.4 platform).

    A web application developed for JSP 1.2 has a servlet 2.3 deployment descriptor (web.xml). JSP 2.0 provides backwards compatibility for JSP 1.2 web applications by disabling by default the EL machinery (i.e. evaluation of EL expressions) when a web application has a servlet 2.3 deployment descriptor. A web application that uses JSTL 1.0 and which is deployed with a servlet 2.3 deployment descriptor therefore runs without any modification in a J2EE 1.4 environment because EL expressions are ignored by JSP 2.0, and JSTL 1.0 keeps evaluating them as was the case with JSP 1.2.

    To support backwards compatibility, JSTL 1.1 introduces new URIs that must be specified to use the new capabilities offered in JSTL 1.1. Among these new capabilities is the evaluation of EL expressions being performed by the JSP 2.0 container rather than JSTL itself. The new URIs for JSTL 1.1 are as follows:

    • http://java.sun.com/jsp/jstl/core
    • http://java.sun.com/jsp/jstl/xml
    • http://java.sun.com/jsp/jstl/fmt
    • http://java.sun.com/jsp/jstl/sql
    The new URIs are similar to the old JSTL 1.0 EL URIs, except that jsp/ has been added in front of jstl, stressing JSTL's dependency on the JSP specification (which now "owns" the EL). It would have been desirable to move forward with the same EL URIs in JSTL 1.1, however this would have only been possible at the cost of losing full backwards compatibility. The JSTL Expert Group felt that maintaining backwards compatibility was more important than preserving the old URIs.

    The JSTL 1.0 URIs are deprecated as of JSTL 1.1. If used, they should normally appear in a web application that has a servlet 2.3 deployment descriptor to disable the JSP 2.0 EL machinery. If used with a servlet 2.4 deployment descriptor, the JSP 2.0 EL machinery must be explicitely disabled for the pages where the JSTL 1.0 tag libraries are used. Consult the JSP specification for details.


    http://jcp.org/aboutJava/communityprocess/final/jsr052/JSR52-ChangeLog_1.1_Final.html




    JSP EL表達式


    JSP EL表達式是包含在符號“${"與"}”之間。例如,${4*8}是一個EL表達式。在Java服務器技術中,不再保留“${"和"}”符號作為EL表達式的專用符號。執行表達式時,JSP容器可能將大括號視為循環的起始括號而顯示錯誤,或得出錯誤的輸出結果。因此,有時需要使用isElgnored屬性禁用EL表達式是。
    Servlet2.3規范未定義EL表達式,因此在JSP1.2中默認是禁用EL表達式,如果在JSP頁面中出現Servlet2.3EL表達式,將被忽略。Servlet2.4定義了EL表達式的模式,而JSP2.0中默認啟用JSP EL表達式。
    <% @page isELIgnored = "true|false"%>
    其中,page表示頁面指令,isELIgnored確定是否應忽略對EL表達式進行計算。
    如果isELIgnored設置為true,當EL表達式在靜態文本或標簽屬性中出現時將被忽略;如果isELIgonred設置為false,EL表達式則由JSP容器進行計算。
    本文來源于:尼克技術博客 http://www.ineeke.cn/ , 原文地址:http://www.ineeke.cn/archives/233/


     


    評論

    # re: 『JSP』jsp 標簽taglib不起作用的問題  回復  更多評論   

    2008-07-20 22:06 by 開發者論壇
    <a href='http://www.keefa.cn'>開發者論壇,軟件開發,編程學習,電腦技術交流歡迎大家來一起交流學習!</a>

    # re: 『JSP』jsp 標簽taglib不起作用的問題  回復  更多評論   

    2008-12-03 19:51 by amberjack
    樓主的這篇文章幫了大忙,正在為這個問題發愁呢,多謝多謝

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲国产精品一区二区久久| 国外亚洲成AV人片在线观看| 亚洲高清免费在线观看| 免费国产午夜高清在线视频| 91亚洲国产成人精品下载| 三年在线观看免费观看完整版中文 | 曰批免费视频播放在线看片二| 青青青青青青久久久免费观看| 亚洲日本VA中文字幕久久道具| 成年女人免费视频播放体验区| 中文字幕乱码亚洲精品一区| 成年轻人网站色免费看| 亚洲JLZZJLZZ少妇| 亚洲国产精品无码久久久久久曰| 一级做α爱过程免费视频| 在线亚洲97se亚洲综合在线 | 又粗又长又爽又长黄免费视频 | 亚洲国产成人久久精品99| 国产特黄一级一片免费 | 日本xxxx色视频在线观看免费| 亚洲资源在线视频| 四虎影视www四虎免费| 黄色a级免费网站| 国产成人亚洲综合色影视| 日本片免费观看一区二区| 亚洲一区二区三区成人网站 | 俄罗斯极品美女毛片免费播放 | 99精品视频免费观看| 亚洲专区一路线二| 国产乱子影视频上线免费观看| 久久一区二区免费播放| 亚洲成a人片在线观看播放| 日韩a在线观看免费观看| 中文字幕免费人成乱码中国| 久久精品国产亚洲AV无码麻豆| 夜夜嘿视频免费看| 在线观看免费黄色网址| 亚洲婷婷第一狠人综合精品| 亚洲片国产一区一级在线观看| 亚洲日本在线免费观看| 日本一区二区三区在线视频观看免费|