JSP中EL隐含对象

JSP中EL隐含对象
EL隐含对象有以下11种:
1.pageContext:取得用户请求或页面信息;
2.pageScope:相当于page.getAttribute(name);
3.requestScope:相当于request.getAttribute(name);
4.sessionScope:相当于session.getAttribute(name);
5.applicationScope:相当于application.getAttribute(name);
6.param:相当于request.getParameter(name);
7.paramValues:相当于request.getParameterValues(name);
8.header:相当于request.getHeader(name);
9.headerValues:相当于request.getHeaders(name);
10.cookie:相当于request.getCookies();
11.initParam:相当于config.getInitParameter(name);

testELform.jsp:
view plaincopy to clipboardprint?
1. <%@ page language="java" contentType="text/html; charset=UTF-8" 
2.     pageEncoding="UTF-8"%> 
3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
4. <html> 
5. <head> 
6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
7. <title>Login</title> 
8. </head> 
9. <body> 
10.     <form action="testELshow.jsp" method="post"> 
11.     Name:<input name="name" type="text" /><br /> 
12.     Sex:  
13.         <input name="sex" type="radio" value="male" />male  
14.         <input name="sex" type="radio" value="female" />female  
15.     <br /> 
16.     Like:  
17.         <input name="like" type="checkbox" value="sing"/>sing  
18.         <input name="like" type="checkbox" value="dance"/>dance  
19.     <br /> 
20.     <input type="submit" value="Submit" /> 
21.     </form> 
22. </body> 
23. </html> 


testELshow.jsp:
view plaincopy to clipboardprint?
1. <%@ page language="java" contentType="text/html; charset=UTF-8" 
2.     pageEncoding="UTF-8"%> 
3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
4. <html> 
5. <head> 
6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
7. <title>Login</title> 
8. </head> 
9. <body> 
10.     Name:${param.name }  
11.     <br /> 
12.     Sex:${param.sex }  
13.     <br /> 
14.     Like:${paramValues.like[0] }  
15.     ${paramValues.like[1] }  
16.     <br /> 
17. </body> 
18. </html> 


你可能感兴趣的:(html,jsp)