JSTL
jstl的介绍:
jsp standard tag library ,jsp标准标签库
jstl的使用步骤:
1.导入jstl-1.2.jar和standard.jar
2.在jsp上导入标签库:
格式:
<%@taglib prefix="" uri="" %>
jstl的分类:
1.core 核心库
2.fmt 格式化
3.sql库
4.xml xml库
了解的jstl标签库:
c:if
c:set
c:foreach
c:choose c:when c:otherwise
c:out
c:remove
c:catch
c:forTokens
c:import
c:url
c:redirect
c:param
c:set
基本用法:对基本属性的操作
格式:
<c:set var="属性名称" value="属性值" [scope="page(默认)|request|session|application"]></c:set>
高级用法:对对象的操作
格式:
<c:set target="域中对象" property="对象的属性" value="属性的值"></c:set>
c:if 用来判断
格式:
<c:if test="el表达式" var="给前面结果起名" scope="将前面的名称放到域中">
c:choose c:when c:otherwise 相当于if(){}else if(){}...else{}
c:foreach 相当于for循环
案例:用jsp+el+ jstl模拟购物车表单
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-66624-4.html
>甲午战败是综合国力的体现