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,

  • 相关阅读:
    Heritrix 3.1.0 源码解析(二十五)
    Heritrix 3.1.0 源码解析(二十八)
    获取某年某月的第一天和最后一天的Sql Server函数
    C# ToString()用法汇总
    数据库隐式类型转换
    sql server 中 SET identity_insert on
    Linq To DataTable
    ASP.NET Session详解[转载]
    CSS overflow 属性
    HTML相对路径(Relative Path)和绝对路径(Absolute Path)
  • 原文地址:https://www.cnblogs.com/liuyanzeng/p/6016887.html
Copyright © 2011-2022 走看看