文档详情

《jstl标签库手册》.doc

发布:2016-09-16约字共9页下载文档
文本预览下载声明
jstl标签库手册 1.JSTL1.1标签库 核心标签库,国际化标签库,数据库标签库,XML标签库,函数标签库 2.EL表达式的默认变量 (1)pageScope,requestScope,sessionScope,applicationScope, 这个4个变量包含Scope作用范围得参数集合,相当于保存在java.util.Map种得某个参数 (2)默认变量param和paramValues param表明请求包含的参数为单一控件,paramValues表明请求包含的参数为控件数组 (3)默认变量header和headerValues 包含请求参数头部信息得集合,header变量表示单一头部信息,headerValue则表示数组型得头部信息 (4)默认变量cookie cookie集合,集合中得每个对象对应javax.servlet.http.Cookie (5)默认变量initParam包含所有应用程序初始化参数得集合 (6)默认变量pageContext 用来提供访问不同得请求参数 EL表达式操作符 empty:用来对一个空变量进行判断:null,一个空String,空数组,空map,没有条目得Collection集合 func:调用方法,func是方法名,args是参数,可以没有,或者有一个,多个参数,参数间用都好隔开 3.JSTL Core标签库 多用途核心标签:c:outc:setc:removec:catch 条件控制标签c:ifc:choosec:whenc:otherwise 循环控制标签c:forEachc:forToken URL相关标签c:importc:urlc:redirectc:param c:out: c:out value={$sessonScope.anyValue} default=no value excapeXml=false / 从Session查找名为anyValue的参数,并显示在页面,若咩有找到则显示no value xcapeXml当设置为true时会主动更换特殊字符,比如“lt;gt;amp;”,默认为true c:set: c:set value=this is andy var=oneString / ${oneString} 将名为oneString得变量赋值为this is andy,其作用范围时page target:被赋值的javaBean实例名 property,javaBean属性名 scope:作用范围,默认为page c:remove: c:remove var=sampleValue scope=session / c:catch: c:catch var=err ${param.smpleSingleValue[9] == 3} /c:catch ${err} 从变量var的err中得到异常内容 c:if c:if test={paramValue.sampleValue[2] == 12} varvisits / It is 12 /c:if ${visits} 将判断得结果保存在visits中 c:choosec:whenc:otherwise: c:choose c:when test=$paramvalues.sampleValue[2] == 11 / not 12 not 13,it is 11 /c:when c:when test=$paramvalues.sampleValue[2] == 12 / not 11 not 13,it is 12 /c:when c:when test=$paramvalues.sampleValue[2] == 13 / not 11 not 12,it is 13 /c:when c:otherwise not 11 12 13 /c:otherwise /c:choose c:forEach: c:forEach items=${seesionScope.arrayList} vararrayListI / ${arrayListI} /c:forEach var用来接收集合的对象,该循环的变量名 c:forTokens: c:forTokens items=aa,bb,cc,dd begin=0 end=2 step2 delims=, var=aValue / ${aValue} /c:forTokens 结果时aa cc,跳两格,截取逗号前面的字符 delims分隔符, varStatus显示循环状态得变量 c:import c:impor
显示全部
相似文档