日期:2014-05-16 浏览次数:20571 次
?
?
servlet2.4 对应 JSP2.0 规范已经完全支持EL表达式,即使不用jstl也可以从session、request里取出对象属性了
?
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.util.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <% Map requestMap=new HashMap(); requestMap.put("a","a"); Map sessionMap=new HashMap(); sessionMap.put("b",requestMap); sessionMap.put("c",null); request.setAttribute("requestMapData",requestMap); session.setAttribute("sessionMapData",sessionMap); %> <font color="red">${requestMapData.a}</font> <br> <font color="black">${sessionMapData.b.a}</font> <br> <font color="blue">${sessionMapData.c.a}</font> </body> </html>?