页面中调用函数--之${fn:}内置函数

函数描写叙述

  • fn:contains(string, substring) 假设參数string中包括參数substring,返回true
  • fn:containsIgnoreCase(string, substring) 假设參数string中包括參数substring(忽略大写和小写),返回true
  • fn:endsWith(string, suffix) 假设參数 string 以參数suffix结尾,返回true
  • fn:escapeXml(string) 将有特殊意义的XML (和HTML)转换为相应的XML character entity code,并返回
  • fn:indexOf(string, substring) 返回參数substring在參数string中第一次出现的位置
  • fn:join(array, separator) 将一个给定的数组array用给定的间隔符separator串在一起,组成一个新的字符串并返回。
  • fn:length(item) 返回參数item中包括元素的数量。參数Item类型是数组、collection或者String。

    假设是String类型,返回值是String中的 字符数。

  • fn:replace(string, before, after) 返回一个String对象。

    用參数after字符串替换參数string中全部出现參数before字符串的地方,并返回替换后的结果

  • fn:split(string, separator) 返回一个数组,以參数separator 为切割符切割參数string。切割后的每一部分就是数组的一个元素
  • fn:startsWith(string, prefix) 假设參数string以參数prefix开头,返回true
  • fn:substring(string, begin, end) 返回參数string部分字符串, 从參数begin開始到參数end位置,包括end位置的字符
  • fn:substringAfter(string, substring) 返回參数substring在參数string中后面的那一部分字符串
  • fn:substringBefore(string, substring) 返回參数substring在參数string中前面的那一部分字符串
  • fn:toLowerCase(string) 将參数string全部的字符变为小写,并将其返回
  • fn:toUpperCase(string) 将參数string全部的字符变为大写,并将其返回
  • fn:trim(string) 去除參数string 首尾的空格 。并将其返回

举例说明:

<c:choose>
<c:when test="${fn:length(audit_message)>0}">
<c:forEach var="message" items="${audit_message}" >
<li>
<span>
<strong> ${message.title }</strong>
</span>
</li>
</c:forEach>
<c:if test="${audit_message_more}">
<li>
<div class="desc clearfix">
<a href="<%=basePath %>manage/message/list.action">很多其它>></a>
</div>
</li>
</c:if>
</c:when>
<c:otherwise>
<img src="imgs/no_data.png" alt="" class="noData"/>
</c:otherwise>
</c:choose>

JSTL推断字符是否为空

  1. <c:when test="${not empty allowedUploadImageExtension}">

替换回车符:<span>中显示内容含有回车符是不会回车的,全部往往须要把回车符替换为<br>才干正常显示回车效果。

错误:${fn: replace(source,'\n','<br>')}    这样的方法会报错的

正确:<% request.setAttribute("vEnter", "\n");  %>

${fn:replace(source, vEnter, "<br>")

版权声明:本文博客原创文章,博客,未经同意,不得转载。

[JSP][JSTL]页面调用函数--它${fn:}内置函数、是推断字符串是空的、更换车厢的更多相关文章

  1. 生成器的send方法、递推函数、匿名函数及常用内置函数

    生成器的send方法 在使用yield方法创建生成器时,不仅可以使用next方法进行取值,还可以通过send方法向生成器的内部传值 什么是send方法? send方法相当于高级的next方法,send ...

  2. python 函数 装饰器 内置函数

    函数 装饰器 内置函数 一.命名空间和作用域 二.装饰器 1.无参数 2.函数有参数 3.函数动态参数 4.装饰器参数 三.内置函数 salaries={ 'egon':3000, 'alex':10 ...

  3. 文成小盆友python-num3 集合,函数,-- 部分内置函数

    本接主要内容: set -- 集合数据类型 函数 自定义函数 部分内置函数 一.set 集合数据类型 set集合,是一个无序且不重复的元素集合 集合基本特性 无序 不重复 创建集合 #!/bin/en ...

  4. python之路(4)高阶函数和python内置函数

    前言 函数式编程不用变量保存状态,不改变变量 内置函数 高阶函数 把函数当作参数传给另一个对象 返回值中包含函数 使用的场景演示: num_test = [1,2,10,5,8,7] 客户说 :对上述 ...

  5. python开发函数进阶:内置函数

    一,内置函数 #内置的模块#拿过来直接就用的:内置的函数 #!/usr/bin/env python #_*_coding:utf-8_*_ #内置的模块 #拿过来直接就用的:内置的函数 #作用域相关 ...

  6. mysql 内置函数大全 mysql内置函数大全

    mysql 内置函数大全 2013年01月15日 19:02:03 阅读数:4698 对于针对字符串位置的操作,第一个位置被标记为1. ASCII(str) 返回字符串str的最左面字符的ASCII代 ...

  7. python函数知识六 内置函数二、匿名函数与内置函数三(重要)

    19.内置函数二 abs():绝对值 lst = [1,2,-3,1,2,-5] print([abs(i) for i in lst]) enumerate("可迭代对象",&q ...

  8. Python学习(七)——匿名函数、map函数、filter函数、reduce函数与其他内置函数

    匿名函数 lambda x: x + 1 # lambda:定义匿名函数的关键字 # x:形参 # x+1:程序处理逻辑 fun = lambda x: x + 1 print(fun(5)) #6 ...

  9. Learn day5 迭代器\生成器\高阶函数\推导式\内置函数\模块(math.time)

    1.迭代器 # ### 迭代器 """能被next调用,并不断返回下一个值的对象""" """ 特征:迭代器会 ...

随机推荐

  1. 如何开发auto complete 智能提示功能

    目录(?)[+] 如何开发auto complete 智能提示功能 最近网上好像流传用redis实现,其实智能提示和用什么存储关系不大 07年,我过一个类似的项目 我有几千个名字,随着用户在输入框中不 ...

  2. c#超时锁定

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  3. php 用递归实现的无限级别分类

    <?php header("Content-type:text/html; charset=utf-8"); /**  *   * @category contry_cate ...

  4. 【大话QT之十七】Jenkins介绍及安装使用文档(与Git集成)

    文章文件夹结构例如以下: 1> Jenkins与Git相关介绍 2> Jenkins部署安装 3> Gitblit部署安装 4> Jenkins与Git集成使用 5> 项 ...

  5. JSON-C 的安装与使用

    下载源代码安装步骤 wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz tar xvf json-c-0.9.tar.gz cd jso ...

  6. 第二篇Activity:2、任务和返回堆栈(Tasks and Back Stack)之基本介绍

    参考:http://developer.android.com/guide/components/tasks-and-back-stack.html 在Android中,一个应用程序里面,通常包含了多 ...

  7. UVa 213 Message Decoding(World Finals1991,串)

     Message Decoding  Some message encoding schemes require that an encoded message be sent in two part ...

  8. SVNKIT操作SVN版本库的完整例子

    Model: package com.wjy.model; public class RepositoryInfo { public static String storeUrl="http ...

  9. Java的byte数组

    今天我们讨论一下Java的byte数组.byte数组就是字节数组,每一位存一个字节.看下面程序,猜猜输出多少? package com.wjy.bytes; import java.io.File; ...

  10. hdu2861(递推)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2861 题意:n个板凳有m个人坐,求刚好将序列分成k段的方式. 分析: a[n][m][k]=a[n-1 ...