JSP标签基本介绍 。。。

来源:互联网 发布:windows 10ppt 编辑:程序博客网 时间:2024/05/17 20:11

 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

 

 

JSP 标签列表[14]

<c:catch></c:catch>

 

<c:choose></c:choose>

 

<c:forEach></c:forEach>

 

<c:forTokens items=""delims=""></c:forTokens>

 

<c:iftest=""></c:if>

 

<c:importurl=""></c:import>

 

<c:otherwise></c:otherwise>

 

<c:outvalue=""></c:out>

 

<c:paramname=""></c:param>

 

<c:redirect></c:redirect>

 

<c:remove/>

 

<c:set></c:set>

 

<c:url></c:url>

 

<c:whentest=""></c:when>

 

 

·核心标签库

 

·通用标签

<c:set>

<c:set>

设置网页中的变量

 

 

·条件标签

<c:if>

<c: if >

 用于有条件的执行代码。

 

 

<c:choose>

<c: choose >

类似与javaswitch,用户执行条件语句块

<c:choose>

    <c:when test="${currentStudent.sex == 1}">

       <option value="1" selected></option>

       <option value="2"></option>

    </c:when>

    <c:when test="${currentStudent.sex == 2}">

       <option value="1"></option>

       <option value="2" selected></option>

    </c:when>

    <c:otherwise>

       <option value="1"></option>

       <option value="2"></option>

    </c:otherwise>

</c:choose>

 

·迭代

<c:forEach>

<c:forEach>

用于重复整个对象集合中嵌套的标签体内容

属性意义:

·var 指定导出的范围变量的名称

·items  指定遍历的对象集合。

·varStatus  为遍历状态指定范围变量名称。

·begin  指定开始遍历的索引。

·end指定开始遍历的索引。

 

< c:forTokens >

<c:forTokens items="" delims=""></c:forTokens>

用于遍历用分隔符分割的值的集合

属性意义:

·items  指定要遍历的值的字符串。

·delims  指定用于分割字符串中的记号的字符。

·var  指定导出的范围变量的名称

·varStatus  为遍历状态指定范围变量名称。

 

原创粉丝点击