zoukankan      html  css  js  c++  java
  • 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>
    <%
    request.setAttribute("test", "测试request");
    session.setAttribute("test", "测试EL");
    application.setAttribute("test", "测试application");
    //网页的上下文
    pageContext.setAttribute("test", "测试页面");
    %>
    page = ${test} <br>
    request =${requestScope.test} <br>
    session =${sessionScope["test"]} <br>
    application =${applicationScope.test} 
    <!-- page>request>session>application如果定义的名字一样按照这种顺序查找进行输出 -->
    <br>
    ${"456"+"123"} 
    <br>
    ${123*3}
    <br>
    ${1 eq 1} <!-- 1==1 -->
    <br>
    ${1 ne 1}  <!-- 1 !=1 -->
    <br>
    ${123==123 ? "相等" : "不相等" }
    <br>
    <a href="test01.jsp?name=tom&password=1234">发送get请求</a>
    </body>
    </html>
    

      

    <%@ 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>
    <%
    String name =request.getParameter("name");
    out.write("name="+name);
    
    %>
    
    <br>
    password = ${param.password }  <!--  -->
    <br>
    name = ${param.name }
    <br>
    session test =${test}
    <br>
    application test =${applicationScope.test}
    <br>
    session test1 =${empty (test1) ? "没找到": test1}
    <br>
    session test =${empty (test) ? "没找到": test}
    </body>
    </html>
    

      

    empty  判断变量或对象是否为空,若为空返回true,不为空返回false,

  • 相关阅读:
    Catalan数
    完全背包
    日期问题
    01背包
    NOJ2076
    858. Prim算法求最小生成树
    839. 模拟堆
    850. Dijkstra求最短路 II
    849. Dijkstra求最短路 I
    859. Kruskal算法求最小生成树
  • 原文地址:https://www.cnblogs.com/liuyanzeng/p/6016887.html
Copyright © 2011-2022 走看看