<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>el隐式对象</title> </head> <body> ${pageContext } <!-- pageContext.findAttribute("name") --> <br/> <br/>---------------从指定的page域中查找数据------------------------<br/> <% pageContext.setAttribute("name","aaa"); //map %> ${pageScope.name } <br/>---------------从request域中获取数据------------------------<br/> <% request.setAttribute("name","bbb"); //map %> ${requestScope.name } <br/>---------------从session域中获取数据------------------------<br/> ${sessionScope.user } <br/>--------------获得用于保存请求参数map,并从map中获取数据------------------------<br/> <!-- http://localhost:8080/day12/3.jsp?name=aaa --> ${param.name } <!-- 此表达式会经常用在数据回显上 --> <form action="${pageContext.request.contextPath }/servlet/RegisterServlet" method="post"> <input type="text" name="username" value="${param.username }"> <input type="submit" value="注册"> </form> <br/>--------------paramValues获得请求参数 //map{"",String[]}------------------------<br/> <!-- http://localhost:8080/day12/3.jsp?like=aaa&like=bbb --> ${paramValues.like[0] } ${paramValues.like[1] } <br/>--------------header获得请求头------------------------<br/> ${header.Accept } ${header["Accept-Encoding"] } <br/>--------------获取客户机提交的cookie------------------------<br/> <!-- 从cookie隐式对象中根据名称获取到的是cookie对象,要想获取值,还需要.value --> ${cookie.JSESSIONID.value } //保存所有cookie的map <br/>--------------获取web应用初始化参数------------------------<br/> ${initParam.xxx } //servletContext中用于保存初始化参数的map ${initParam.root } </body> </html>