JSP、JSTL、EL

來源:互聯網
上載者:User

標籤:

Jsp

Jsp內建對象:

       Response、Request、Page、pageContext、session、out、application、exception、config

Out->jspWriter  相當與緩衝+printWriter

輸出緩衝的條件:jsp執行完畢 滿了 重新整理 關閉

 

通過pageContext可以擷取其他八個對象。

pageContext.setAtrribute(“”,域範圍); 作用看域範圍

pageContext.setAtrribute(“”);       作用page範圍

 

pageContext.getAttribute()如果有域範圍要寫上,不然擷取不到

 

自動搜尋:pageContext.findAttribute();從小範圍到大範圍

 

Jsp主要用於顯示資料

Jsp標籤

轉寄

<jsp:forword page=””>

       <jsp:param name=”” value=””/>//變數放在這

<jsp:include uri=””>//動態包含

與靜態包含的區別:

靜態          動態

1、 先合并後編譯  先編譯後合并

2、 引用文法不一致

3、 不帶參數       帶參數

 

EL運算式

${}

就能顯示。顯示變數或者運算式結果、對象。

 

 

JSTL:java標準標籤庫

核心標籤庫   C

使用方式:

1、 引入jstl包  如果建立項目選擇EE5.0及以上版本可以省略導包

2、 引入介面:<%@ taglib uri=”” prefix=””%>

3、 Uri與perfix可以參考jar包內metainfo/c核心標籤庫

<c:set>

 

<c:if test=””>

 

<c:choose>

<c:when test=””>

<c:otherwise>

 

<c:foreach var=”” varStart=”” begin end step items>

 

<c:forTokens items=”” delims=””>

<c:redirect>

 

JSP、JSTL、EL

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.