zoukankan      html  css  js  c++  java
  • 使用fn函数控制页面显示内容 Yannis

    在使用EL的时候,不可避免的遇到,截取字符串,判断字符串长度等情况。这里给出简单的通过fn函数操作字符串的deamon。

    1、页面引入标签

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

     2、对内容的处理

    <c:choose><c:when test='${fn:length(dutyLog.content) >= 100}'>${fn:substring(dutyLog.content,0,100)}...</c:when><c:otherwise>${dutyLog.content}</c:otherwise></c:choose>
     ${fn:length(dutyLog.content)}获取dutyLog.content的对应长度;
    ${fn:substring(dutyLog.content,0,100)}截取dutyLog.content的长度,${fn:substring(str,beg,end)}

    特此记录,以待下次使用。

  • 相关阅读:
    BZOJ 2527 Meteors 整体二分
    BZOJ 1176: [Balkan2007]Mokia
    DP杂题2
    点分治
    一些图论模板
    一些字符串的题
    斐波那契+线段树
    BZOJ 2957楼房重建
    POJ
    BZOJ 2002 弹飞绵羊
  • 原文地址:https://www.cnblogs.com/pigga/p/10098334.html
Copyright © 2011-2022 走看看