Jsp的表达式语言(el)
2008-04-12 22:29
531 查看
推荐网址:
http://www.oracle.com/technology/global/cn/sample_code/tutorials/jsp20/simpleel.html
http://www.ibm.com/developerworks/cn/java/j-jstl0211/
实例:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!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>JSP Page</title>
</head>
<body>
<%@ include file="test.jsp" %>
<h1>JSP Page</h1>
<%
pageContext.setAttribute("color","#FFFFCC");
%>
<body bgcolor = '${pageScope.color}' >
<h1>变化的背景色</h1>
<h1>比较运算符</h1>
<b>
4 > 3 $...{4 > 3}<br/>
4 < 3 $...{4 < 3}<br/>
4 ≥ 3 $...{4 >= 3}<br/>
4 ≤ 3 $...{4 le 3} <br/>
4 = 4 $...{4 == 4}
</b>
<h1>Empty 运算符</h1>
$...{empty(Null)}
$...{empty("test")}
<b>
</b>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello $...{param.name}!
</c:if>
--%>
</body>
</html>
结果:
4 < 3 false
4 ≥ 3 true
4 ≤ 3 false
4 = 4 true
http://www.oracle.com/technology/global/cn/sample_code/tutorials/jsp20/simpleel.html
http://www.ibm.com/developerworks/cn/java/j-jstl0211/
实例:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!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>JSP Page</title>
</head>
<body>
<%@ include file="test.jsp" %>
<h1>JSP Page</h1>
<%
pageContext.setAttribute("color","#FFFFCC");
%>
<body bgcolor = '${pageScope.color}' >
<h1>变化的背景色</h1>
<h1>比较运算符</h1>
<b>
4 > 3 $...{4 > 3}<br/>
4 < 3 $...{4 < 3}<br/>
4 ≥ 3 $...{4 >= 3}<br/>
4 ≤ 3 $...{4 le 3} <br/>
4 = 4 $...{4 == 4}
</b>
<h1>Empty 运算符</h1>
$...{empty(Null)}
$...{empty("test")}
<b>
</b>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello $...{param.name}!
</c:if>
--%>
</body>
</html>
结果:
test
JSP Page
变化的背景色
比较运算符
4 > 3 true4 < 3 false
4 ≥ 3 true
4 ≤ 3 false
4 = 4 true
Empty 运算符
true false相关文章推荐
- 【学习】JSP 2 特性:表达式语言(EL)
- 表达式语言(EL)在jsp中的使用
- JSP 笔记 —— EL 表达式语言
- JSP表达式语言(EL)
- 0906 JSP的表达式语言EL
- JSP 2.1-2.5上用JSTL和EL(表达式语言)的问题
- EL(表达式语言 ) jsp2.0新增的功能
- EL(JSP中的表达式语言)
- [Servlet&JSP] 表达式语言EL
- 实验十三 JSP表达式语言——EL
- JDBC+Servlet+JSP整合开发之29-JSP表达式语言(EL) 推荐
- JSP表达式语言(EL)
- jsp表达式语言EL导致的问题
- 表达式语言(EL)---JSP
- 【jsp】详解JSP表达式语言(EL)
- JSP中的EL (Express Language表达式语言)
- 初始JSP表达式语言-EL
- JSP EL语言定义
- 【第五章】Spring表达式语言 之 5.4在Bean定义中使用EL—跟我学spring3
- Spring表达式语言 之 5.4在Bean定义中使用EL(拾伍)