jsp之EL運算式

來源:互聯網
上載者:User

標籤:使用   io   app   js   text   user   

1、null值

null值會用""進行顯示

2、隱式對象

1)、pageScope、requestScope(相當於request)、sessionScope(相當於session)、applicationScope(相當於servletContext)(這些跟範圍有關)

${requestScope.userName} 相當於 request.getAttribute("userName");

sessionScope、applicationScope相同

2)、param、paramValues

${param.userName}相當於request.getParameter("userName");

${paramValues.userName[0]} 相當於request.getParameterValues("userName")[0]

3)、${userInfo.userName} 預設尋找範圍是pageScope、requestScope、sessionScope、applicationScope,沒有找到顯示""

4)、cookie

${cookie.userInfo.value}擷取cookie名為userInfo的值

5)、header、headerValues 擷取頭部資訊

${header["User-Agent"]}

6)、initParam

${initParam.userName} 相當於application.getInitParameter("userName")

7)、pageContext 擷取頁面其它資來源物件

3、運算子

. 可用於對象、map,擷取對象的某個屬性的值,使用getXXX方法的XXX,即對象.XXX或對象["XXX"];在map中使用:map對象.鍵名

[] 可用於對象、map、數組、List

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.