el表达式

Posted haiziguo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了el表达式相关的知识,希望对你有一定的参考价值。

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.lzp.domain.*" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP ‘el.jsp‘ starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
  
  <body>
    <c:out value="el表达式测试"></c:out>
    <%
    request.setAttribute("username", "requestusername");
    session.setAttribute("username", "sessionusername");
    pageContext.setAttribute("username", "pageContextusername");
    application.setAttribute("username", "applicationusername");
     %>
     <c:out value="全域查找结果"/>
     ${username }
     <br/>
     
     
     ${pageScope.username}<br/>
     ${applicationScope.username }<br/>
     ${sessionScope.username}<br/>
     ${requestScope.username}<br/>
     
     <h6>javaBean与el相结合的使用</h6>
     <%
     Person p =new Person();
     p.setAge(22);
     p.setName("王小明");
     request.setAttribute("p", p);
     
      %>
     ${p.age }${p.name }
     
     <h6>其他对象</h6>
     ${param.XXX }
     ${paramValues.YYY[0] }
     ${paramValues.YYY[1] }
     
     ${cookie.JSESSIONID.value}=${cookie.JSESSIONID.name}
     
     ${pageContext.request.contextPath }
     
     
     ${fn:length(paramValues)}
     ${fn:toLowerCase(param.XXX)}
     
  </body>
</html>

http://localhost:8090/jstl/el.jsp?XXX=AAA&YYY=yyy&YYY=yyy1

以上是关于el表达式的主要内容,如果未能解决你的问题,请参考以下文章

jsp--EL表达式

jsp中的EL表达式

Jsp入门EL表达式_学习笔记

第五条知识点

EL表达式

EL表达式的基本知识