JSTL 标签库

  • out 标签
    value:输出值,default:默认输出值,escape:特殊字符是否转义
    
    HtmlUtils.htmlUnescape(help); -> 富文本不转义(Spring)
  • redirect 标签
        
            
            
        
        
  • set 标签
     -> 方式一
     -> 方式二
     -> 赋值
  • remove 标签
     -> 请求域移除参数
  • if 标签
    结果为True,执行标签体
    
         
                new
         
    
  • case 标签
    <%--大写转换小写--%>
    ${fn:toLowerCase("ITCAST")}
<%--小写转换大写--%> ${fn:toUpperCase("wjx")}
  • fn:contains 标签
    <%--区别大小写--%>
    ${fn:contains("wjx","w")};
${fn:contains("wjx","W")};
<%--不区别大小写--%> ${fn:containsIgnoreCase("wjx","w" )};
${fn:containsIgnoreCase("wjx","W" )};
  • fn:escapeXml 标签
    ${fn:escapeXml("
")}

${""}
  • fn:indexOf 标签
    ${fn:indexOf("wjx","w" )}
${fn:indexOf("wjx","j" )}
${fn:indexOf("wjx","x" )}
  • fn:join 标签
    <%  String strs[]={"www","itcast","com"};  %>
    
    ${fn:join(strs,".")}
  • fn:length 标签
    <%
    int[] array={1,2,3,4};
    List list = new ArrayList();
    list.add("one");
    list.add("two");
    list.add("three");
    %>

    
    
    数组长度:${fn:length(array)}
集合长度:${fn:length(list)}
字符串长度:${fn:length("Tomcat")}
  • fn:replace 标签
    <%--字符串替换--%>
    ${fn:replace("w.j.x","." ,"" )}
  • fn:split 标签
    
    
        
  • fn:substring 标签
    <%--字符串抽取--%>
    ${fn:substring("wjx",0 ,2 )}
${fn:substringBefore("wjx", "j")}
${fn:substringAfter("wjx","j" )}
  • fn:trim 标签
    <%--清除字符串前后的空格--%>
    ${fn:trim("wjx")}
  • fn:startsWith 标签 、fn:endsWith 标签
    <%--开头--%>
    ${fn:startsWith("wjx","w")}
${fn:startsWith("wjx","j")}
<%--结束--%> ${fn:endsWith("wjx","x" )}
${fn:endsWith("wjx","j" )}
  • catch 标签
    
        <%
        int j=10;
        int i=0;
        System.out.println(j/i);
        %>
    
  • choose 标签
    
        
            param没有参数
        
        
        
            wjx
        

        
            else
        
    
  • forEach 标签
<%--数组--%>
<%
    String[] fruits = {"apple", "orange", "grape", "banana"};
%>

    ${wjx}
<%--Map集合--%> <% Map map = new HashMap(); map.put("Tom", "123"); map.put("Mike", "123"); map.put("Lina", "123"); %> ${map.key}  ${map.value}
<%--List集合--%> <% List list = new ArrayList(); list.add("red"); list.add("yellow"); list.add("blue"); list.add("green"); %> ${!status.first} -> 第一个Item ${!status.last} -> 最后一个Item ${color}
  • forTokens 标签

    ${token}
 
  • formatDate 标签
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

  • EL表达式的判断符号
                     等于  ==    eq 
                   不等于  !=    ne、neq
                     大于  >     gt 
                     小于  <     lt 
                 大于等于  >=    ge、gte
                 小于等于  <=    le、lte
                       与  &&    and 
                       或  ||    or 
                       非  !     not 
                       加  + 
                       减  - 
                       乘  * 
                     除以  /     div 
                     求莫  %     mod 

你可能感兴趣的:(JSTL 标签库)