标签:
首先要导入jar包
jst1.jar standard.jar
在页面中引入标签库
<%@taglib uri="..." prefix=".."%>
<%@page import="com.itheima.domain.Person"%> <%@page import="java.util.List"%> <%@page import="java.util.ArrayList"%> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Insert title here</title> </head> <body> fn:contains函数用于判断在源字符串中是否包含目标字符串:${fn:contains("tomcat","cat") }<br/> fn:containsIgnoreCase函数用于判断在源字符串中是否包含目标字符串,并且在判断时忽略大小写:${fn: containsIgnoreCase ("Tomcat","CAT")}<br/> fn:startsWith函数用于判断源字符串是否以指定的目标字符串开头:${fn:startsWith("tomcat","tom") }<br/> fn: endsWith函数用于判断源字符串是否以指定的目标字符串结尾:${fn:endsWith("tomcat","cats") }<br/> fn:indexOf函数用于在源字符串中查找目标字符串:${fn: indexOf ("Tomcat","cat")}<br/> fn:replace函数用于把源字符串中的一部分替换为另外的字符串,并返回替换后的字符串:${ fn: replace("TomcAt","cAt","cat")}<br/> fn:substring函数用于获取源字符串中的特定子字符串:${ fn: substring ("Tomcat",0,3)}<br/> fn:substringBefore函数用于获取源字符串中指定子字符串之前的子字符串:${ fn: substringBefore ("Tomcat","cat")}<br/> fn: substringAfter函数用于获取源字符串中指定子字符串之后的子字符串:${ fn: substringAfter ("Tomcat","Tom")}<br/> n:split函数用于将源字符串拆分为一个字符串数组:${ fn: split ("www.mywebsite.org",".")}<br/> fn:join函数用于将源字符串数组中的所有字符串连接为一个字符串:<br/> fn:toLowerCase函数用于将源字符串中的所有字符改为小写:fn:toLowerCase("TomCat")<br/> fn: toUpperCase函数用于将源字符串中的所有字符改为大写:fn: toUpperCase ("TomCat")<br/> fn:trim函数用于将源字符串中的开头和末尾的空格删除:fn:trim(" Tomcat ")<br/> 遍历forEach: <% List list=new ArrayList(); list.add("name"); list.add("age"); request.setAttribute("list", list); %> <c:forEach items="${list }" var="p"> ${p }<br/> </c:forEach> </body> </html>
标签:
原文地址:http://www.cnblogs.com/lzzhuany/p/4722368.html