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

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

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

    kooyee ‘s blog

    開(kāi)源軟件, 眾人努力的結(jié)晶, 全人類(lèi)的共同財(cái)富
    posts - 103, comments - 55, trackbacks - 0, articles - 66
       :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    『JSP』jsp 標(biāo)簽taglib不起作用的問(wèn)題

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

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

    啟用EL或修改webv.xml為jsp2.0可以解決問(wèn)題。



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

    page指令的isELIgnored屬性是控制EL的使用權(quán)的,它的兩個(gè)值,true和false
    如果 isELIgnored='true'表示禁用EL,isELIgnored='false' 表示可以使用EL, 默認(rèn)是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表達(dá)式


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


     


    評(píng)論

    # re: 『JSP』jsp 標(biāo)簽taglib不起作用的問(wèn)題  回復(fù)  更多評(píng)論   

    2008-07-20 22:06 by 開(kāi)發(fā)者論壇
    <a href='http://www.keefa.cn'>開(kāi)發(fā)者論壇,軟件開(kāi)發(fā),編程學(xué)習(xí),電腦技術(shù)交流歡迎大家來(lái)一起交流學(xué)習(xí)!</a>

    # re: 『JSP』jsp 標(biāo)簽taglib不起作用的問(wèn)題  回復(fù)  更多評(píng)論   

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

    只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲国产精品日韩在线观看| 一个人免费视频在线观看www| 香蕉视频在线观看亚洲| 亚洲精品国产成人片| 精品免费久久久久国产一区| 中文字幕亚洲综合久久综合| 亚洲AV人无码综合在线观看| 亚洲日韩中文在线精品第一| 夜夜爽免费888视频| 人与禽交免费网站视频| 久久精品乱子伦免费| 9久热精品免费观看视频| 黄页网址在线免费观看| 亚洲最大av资源站无码av网址| 国产一卡二卡≡卡四卡免费乱码 | 免费一级毛片在级播放| 免费看韩国黄a片在线观看| 四虎在线免费视频| 久久久久久久岛国免费播放| 国内精品免费视频精选在线观看| 免费一级毛片在线播放放视频| 亚洲精品中文字幕| 亚洲精品无码久久久久秋霞| 亚洲日韩一区二区一无码| 亚洲AV无码久久精品成人| 亚洲宅男天堂在线观看无病毒 | 男人免费视频一区二区在线观看 | 日本片免费观看一区二区| 久久久久久久久久国产精品免费| 免费无码一区二区三区蜜桃| 久久精品免费网站网| a级毛片免费播放| a毛片免费全部播放完整成| aa级女人大片喷水视频免费| 久久久精品视频免费观看| WWW免费视频在线观看播放 | 亚洲综合另类小说色区| 青青草原亚洲视频| 亚洲精品无码mv在线观看网站| 亚洲色成人网站WWW永久| 亚洲va久久久噜噜噜久久|