日期:2014-05-17  浏览次数:20655 次

关于el 《c:if》。。。。
我想判断一个字符串s里面是否含有“.img”和“.gif”的字符串 el表达式应该怎么写呢

------解决方案--------------------
可以用 functions库
HTML code

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!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>
    <c:set scope="page" var="name" value="zhoufeng"></c:set>
    
    <!-- 判断是否以eng结尾 -->      
    <c:if test="${fn:endsWith(name ,'eng')}">     
        ${name }
    </c:if>           
</body>         
</html>