<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
String s="hello";
pageContext.setAttribute("s",s);
%>
<jsp:useBean id="s1" class="com.itheima.domain.Student" scope="session"></jsp:useBean>
${s }<br/>
<%
// pageContext.setAttribute("k","kkkko");
request.setAttribute("k","aaarrkkrr");
%>
${k }
${s1 }
<%--
//EL表达式的原理
String str=(String)pageContext.findAttribute("p");//依次从 page request session application中查找
if(str==null)
out.write("");
else
out.write(str);
--%>
${uhfufu.name }<br/>
${s1.address.province }<br/>
${s1["address"]["province"] }<br/>
${s1.class.simpleName }<br/>
${s1.class.name }<br/>
${s1.class }
<%
List list=new ArrayList();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
pageContext.setAttribute("list",list);
%>
${list[3] }<br/>
<%
Map map=new HashMap();
map.put("a","aa");
map.put("c","cc");
map.put("b","bb");
pageContext.setAttribute("map",map);
%>
${map .b}
</body>
</html>
|
|