标签:
<%@page import="java.util.*"%>
<%@ page language= "java" contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%--字符串 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
<head>
<meta charset="utf-8">
<title>使用foreach</title>
</head>
<body>
<%
List list = new ArrayList();
list.add("zhangsan1");
list.add("zhangsan2");
list.add("zhangsan3");
list.add("zhangsan4");
list.add("zhangsan5");
request.setAttribute("all", list);
pageContext.setAttribute("info", "nihao lovo, hello");
%>
<c:forEach items="${all}" var="mement">${mement}</c:forEach>
<h3>查找lovo:${fn:contains(info,"lovo")}</h3>
<h3>判断开头:${fn:startsWith(info,"lovo")}</h3>
<h3>判断结尾:${fn:endsWith(info,"hello")}</h3>
<h3>查找位置:${fn:indexOf(info,",")}</h3>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/xiongda1115/p/5823442.html