您的位置:首页 > Web前端 > JavaScript

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>



 

结果:

test

JSP Page

变化的背景色

比较运算符

4 > 3 true
4 < 3 false
4 ≥ 3 true
4 ≤ 3 false
4 = 4 true


Empty 运算符

true false
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jsp 语言 html null c