标签:页面 obj hashmap image 属性的方法 color requests 变量 服务器
EL知识点总结 - canger - 博客园
http://www.cnblogs.com/canger/p/6675799.html
<% String name = "James"; request.setAttribute("name",name); int age = 30; %> <h2>${name}</h2> <h2>${age}</h2>
<% String name = "James"; request.setAttribute("name",name); %> <h2>${name}</h2> <h2>$${name}</h2> <h2>{${name}</h2>
<h2>\${}</h2> <h2>${"${}"}</h2>
<h2>${123+"124"}</h2>
<% request.setAttribute("emptyString",""); request.setAttribute("nullObject",null); request.setAttribute("emptyList",new ArrayList<String>()); request.setAttribute("emptyMap",new HashMap<String,String>()); %> <h2>${empty emptyString}</h2> <h2>${empty nullObject}</h2> <h2>${empty emptyList}</h2> <h2>${empty emptyMap}</h2> </body>
<% request.setAttribute("requestString",request.toString()); %> <html> <body> <h2>${requestString}</h2> <h2>${pageContext.request}</h2> </body> </html>
<% request.setAttribute("name","Shao"); %> <h2>${requestScope["name"]}</h2> <h2>${requestScope.name}</h2>
注意,下面的写法是错误的,因为request对象并不存在getName方法
<h2>${pageContext.request.name}</h2>
<h2>${pageContext.request.serverPort}</h2>
标签:页面 obj hashmap image 属性的方法 color requests 变量 服务器
原文地址:http://www.cnblogs.com/rogge7/p/6970323.html