empty运算符:
<Myc:if test="${empty requestScope.sentenceList}"> <h1>该页无数据记录或输入的页码有误!</h1> </Myc:if>
二元表达式:
${user!=null?user.name:""}//user不为空取值为user.name,如果为空取值“” 隐含对象名称: pageContext pageScope requestScope sessionScope applicationScope param (表示一个保存了所有请求参数的Map对象) paramValues (对于某个请求参数,返回的是一个String[])header (保存所有http请求头字段的Map对象)cookieinitParam (保存所有web应用初始化参数的map) 注意事项: headerValues取值,若头里面有“-”,则要headerValues["Accept-Encoding"] cookie取值,${cookie.key}取得是cookie对象,若访问cookie的名称和值,需要${cookie.key.name}或${cookie.key,value} 页面中使用JSTL定义的EL函数: <%taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> fn:toLowerCase("xxx")//转小写 fn:toUpperCase("xxx")//转大写 fn:trim("xxx")//去掉字符串首尾空格 fn:length("xxx") fn:split("xxx.yyy.zzz",".")[1]//返回值为字符串yyy fn:join({"aaa","bbb","ccc"},".")//"aaa.bbb.ccc" fn:indexOf("xxxaxxx","a")//结果为3,不包含-1,第二个字符串为空0 fn:contains(string,substring)//boolean fn:containsIgnoreCase()//忽略大小写 fn:startsWith("axxxxxxx","b")//false fn:endWith() fn:replace("www it315 org"," ",".")//www.it315.org fn:substrign("abcdefg",2,4)//cde fn:substringAfter("www.baidu.com",".")//"baidu.com" fn:substringBefore() 环境: jstl.jar standard.jar 标签库: c:核心标签库fmt:国际化标签sql:数据库标签xml:el:JSTL函数(EL函数)
