Home > Java > javaTutorial > What does jsp c: mean?

What does jsp c: mean?

藏色散人
Release: 2020-09-19 13:48:49
Original
5582 people have browsed it

The ":c" tag in jsp is the core tag library in jstl. How to use it: 1. "" displays data in jsp, which is equivalent to "<%=. ..%>"; 2. "" is used to save data, variables and objects; 3. "" is used to delete variables within the specified scope.

What does jsp c: mean?

##Use of c tags in jsp

The c tag is the core tag library in jstl

1.: Displaying data in jsp is equivalent to <%=...%>

Syntax:

<c:out value="值" escapeXml="{true|false}" default="默认值">
Copy after login

escapeXml: Whether to escape the characters "<", ">", "&", " ' ", " " "

default: Display when the value is empty

2.: Used to save data, save variables and objects

Syntax:--Variable

<c:set value="值" var="变量名" scope="变量的作用域"></c:set>
Copy after login

--Object

 <c:set target="对象名" property=" 对象属性名" scope="变量的作用域"></c:set>
Copy after login

3.: Used to delete variables within the specified scope

Syntax:

<c:remove var="变量名" scope="作用域"/>
Copy after login

4. is used to handle exceptions that cause errors and save error information

Syntax:

<c:catch var="变量名"></c:catch>
Copy after login

5. The judgment statement has no else function

Grammar:

<c:if test="${my eq &#39;dd&#39;}"></c:if>
Copy after login

6. is equivalent to the switch statement in java used with and

Grammar:

<c:choose>
<c:when test="${my eq &#39;w&#39;}"></c:when>
<c:when test="${my eq &#39;g&#39;}"></c:when>
<c:otherwise></c:otherwise>
</c:choose>
Copy after login

7. Equivalent to java’s for loop

Syntax:

<c:forEach items="${保存在作用域的变量名}" var="用来循环的名" varStatus="status" begin="开始" end="结束">
</c:forEach>
<c:forEach items="${infoList}" var="info" varStatus="status">
<c:if test="${status.index%4==0}"><tr></c:if>
<td>${info.id}</td>
<td>${info.type}</td>
<c:if test="${(status+1)%4==0}"</tr></c:if>
-------功能是循环四个后实现换行
Copy after login

8.

can be used Single label, jump to the specified page

<a href="<c:url value=&#39;top.jdp&#39;/>"
Copy after login

Set url

<c:url value="http://www.baidu.com" var="baidu"> 
<c:param name="name" value="宝宝"/>
<c:param name="age" value="29"/>
</c:url>
Copy after login

Finally form http://www.baidu.com?name='Baby'&age=29

9. Used to pass parameters to included or redirected pages

10.Iterative output string

 <c:forTokens items="字符串" delims="分界符" var="变量名"
          varStatus="遍历状态名" begin="begin" end="end" step="sep">
            标签体     
    </c:forTokens>
Copy after login

11.Redirect to a new URL

<c:redirect url="地址" context="上下文路径">
         <c:param/>标签 --------------可以不写
</c:redirect>
Copy after login

The above is the detailed content of What does jsp c: mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
c jsp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template