EL表達式用法總結

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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>
<!--簡單運算  -->
${17+2}
<!--==和eq的用法完全 相同   -->
${5==5}
${5 eq 5}
${4<5}
${4 lt 5}
&{3>2&&2<1}
${3>2and 2<1}
${3>2||2<1}
${3>2 or 2<1 }
${!(3>2)}
<!-- empty判斷p存在不存在,再判斷p的內容是否是空的 -->
${empty p}
${a?b:c}
<!-- 在四個作用域由小到大搜索 -->
${name}
<!-- 從request中搜索屬性名字爲password的值 -->
${requestScope.password}
<%-- <%
		pageContext.setAttribute("name", "zs");
		request.setAttribute("password", "123");
		Student s = new Student();
		s.setName("ls");
		request.setAttribute("s", s);
	%> --%>
<!-- 取出s對象的名字的名字 -->
${s.name }
${s["name"] }
<!-- 系統和瀏覽器信息 -->
${header["User-Agent"] }
<!-- 工程根目錄 -->
${pageContext.request.contextPath }	

	
</body>
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章