标签:ram ack 支持 html map class 作用 body style
<%@ page language="java" pageEncoding="utf-8" import="com.study.vo.*,java.util.*" %> <html> <head> </head> <body> <h2>使用普通方法获得作用域对象</h2> <b><%=request.getParameter("name")%></b><br/> <b><%=request.getAttribute("str")%></b><br/> <b><%=((User)request.getAttribute("user")).getAddress().getAddr() %></b><br/> <b><%=((ArrayList<User>)request.getAttribute("list")).get(0).getAddress().getAddr() %></b><br/> <b><%=((HashMap<String,User>)request.getAttribute("map")).get("user").getAddress().getAddr()%></b> <hr/> <h2>使用EL表达示获得作用域对象(优点:不用导包,阅读方法,代码更少)</h2> <b>${param.name}</b><br/> <b>${str}</b><br/> <b>${user.address.addr}</b><br/> <b>${list[0].address.addr}</b><br/> <b>${map.user.address.addr}</b><br/> <h2>EL表达式获取对象默认顺序</h2> <% pageContext.setAttribute("hello","pagecontext"); request.setAttribute("hello","request"); session.setAttribute("hello","session"); application.setAttribute("hello","application"); %> <b>pageContext-->request-->session-->application</b><br> <b>${pageScope.hello}</b><br> <b>${requestScope.hello}</b><br> <b>${sessionScope.hello}</b><br> <b>${applicationScope.hello}</b><br> <h2>EL表达式的算术运算</h2> <strong>不支持字符串连接</strong><br/> ${1+2}--${1-2}--${1>2}--${1==2?0:0}--${1+"2"} </body> </html>
标签:ram ack 支持 html map class 作用 body style
原文地址:https://www.cnblogs.com/lastingjava/p/9899032.html