zoukankan      html  css  js  c++  java
  • EL表达式

    JSTL简介:SUN的标准Taglib库,和其他jar文件没有任何关联。

    JSP标准标签库

    容器要求2.4以上

     

    表达式语言:EL

    ${Scope中的对象}

    el中的隐含对象(如果未指定scope,则寻找的顺序为)pageScope,requestScope,sessionScope,applicationScope,

    //普通字符串

    request.getAttribute(“hello”),${hello},${requestScope.hello}

    //结构 采用.进行导航,也称存取器

    ${user.username},${user.group.name},属性必须有getter方法

    //Map  EL表达式没有循环,需借助JSTL

    ${mapValue.key1},${mapValue.key2}

    Map mapValue=new HashMap();

    mapValue.put(“key1”,”value1”);mapValue.put(“key2”,”value2”)

    mapValue

    //字符串数组 采用[]和下标 下标从0开始

    String[] atrArray=new String[]{“a”,'”b”,'‘”c”}

    ${atrArray[0]}

    //对象数组 采用[]和下标 下标从0开始

    User[] users=new User[10];

    ${users[3].username}

    //List  同数组

    ${userList[2].username}

    List userList=new ArrayList();

    userList.add(new User());

    //el表达式对运算符的支持

    ${1+2}:页面上输出3

    ${10/5},${10 div 5}:页面输出2.0

    ${10 mode 5},${10 % 5}:求余

    //测试Empty

    ${empty value1}:如果value1为空,则为true,否则为发false

  • 相关阅读:
    A1044. Shopping in Mars (25)
    A1019. General Palindromic Number (20)
    A1018. Public Bike Management (30)
    26850: 收集数码晶体 有40%错误
    A1016. Phone Bills (25)
    A1014. Waiting in Line (30)
    A1011. World Cup Betting (20)
    A1010. Radix (25)
    A1009. Product of Polynomials (25)
    A1008. Elevator (20)
  • 原文地址:https://www.cnblogs.com/guaniu/p/2324069.html
Copyright © 2011-2022 走看看