EL 表达式主要是代替 jsp 页面中的表达式脚本在 jsp 页面中进行数据的输出。
jsp 页面中的表达式脚本:
EL 表达式:
- EL 获取四个特定域中的属性
当四个域中都有相同的 key 的数据的时候,EL 表达式会按照四个域的从小到大的顺序去进行搜索,找到就输出
pageScope ====== pageContext 域
requestScope ====== Request 域
sessionScope ====== Session 域
applicationScope ====== ServletContext 域
<%
pageContext.setAttribute("key1", "pageContext1");
pageContext.setAttribute("key2", "pageContext2");
request.setAttribute("key2", "request");
session.setAttribute("key2", "session");
application.setAttribute("key2", "application");
%>
${applicationScope.key2}<br/>
${pageScope.key2}