JSTL(不依赖与框架)
EL(正则表达式)
1,EL表达式使用的方法${... }
2,EL的隐含对象PageScope, requestScope, sessionScope, applicationScope,如果未指定scope,它搜索的顺序为:pageScope---->applicationScope
3,el使用“.”来进行导航,只要有getter方法就可以进行导航
4,el的运算符:
(既可以用左边的也可以用右边的)
%--->mod / ----->div == ----->eq
!= ---> ne < -----> lt > ----->gt <= ------> le >= ------> ge
&&----->and || ----> or ! ------->not
5,对于jstl要将jstl中相应的jar包拷贝到Web-inf/lib目录下,但是如果只是用el表达式的话,则不用。
注:jstl必须能够支持j2ee1.4/Servlet 2.4 /jsp 2.0版本以上容器才能运行。jstl要用scope中的数据必须和el结合。
常用的jstl标签:
在使用jstl标签之前要引入标签库:方法<%@ taglib prefix=" " uri=" " %>具体参考standard.jar-->META-INF-->c.tld
1,<c:out ></c:out>用来输出,但是很多时候都是用el表达式来输出
2,相当于if
<c:if test=""></c:if>判断,判断为空一般是这样:<c:if test="${!empty 名称 }" ></c:if>其中empty是函数名
3,相当于if else
<c:choose>
<c:when test="${ }">
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
4,相当于jsp中的include标签
<c:import url="">
</c:import>
5, 重定向
<c:redirect context="相对路径"></c:redirect>
6,循环语句
<c:forEach items="${orgs }" var="orgnization">
</c:forEach>
其中items传过来的相当于List,var则相当于变量,如果要一个一个值输出来:可以${orgnization }
7,函数库:<fmt:formatDate /> <fmt:formatNumber />