在EL表达式中为我们提供了许多内置对象,让我们很方便的得到我们想要的数据:
1.从隐式对象中得到数据:
pageScope 例如:${pageScope.user.userName} 相当于<%=page.getAttribute(
"user"
).getUserName%>
requestScope 例如:${requestScope.books} 相当于<%=request.getAttribute(
"books"
)%>
sessionScope 例如:${sessionScope.lastURL} 相当于<%=session.getAttribute(
"lastURL"
)%>
applicationScope 例如:${applicationScope.provice} 相当于<%=application.getAttribute(
"provice"
)%>
2.从请求头中得到数据:
header 例如:${header.referer}得到请求过来的URL
3.访问JSP页面中的内置对象:
pageContext 例如:${pageContext.request}在EL表达式中我们是不能直接使用JSP页面的内置对象,但可以是用pageContext间接得到这些内置对象,再来使用。