ch13.JSP标准标签库

来源:互联网 发布:gta5女人物捏脸数据 编辑:程序博客网 时间:2024/05/16 12:40

加载jstl包

JSTL主要标签分类:

 

<c:out >输出:

<%@ page contentType="text/html" pageEncoding="GBK"%><%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix="c" %><html>  <head>    <title>My JSP 'tildemo.jsp' starting page</title>  </head>  <body>    <h3><c:out value = "Hello thystar!!!"></c:out></h3>  </body></html>
<c:set>将属性保存在四种属性范围之中

<c:set var = "info" value = "Hello thystar!!!" scope = "request"/><h3>${info}</h3>

<c:remove>移除指定范围的属性

<c:set var = "info" value = "Hello thystar!!!" scope = "request"/><c:remove var = "info" scope = "request"/><h3>内容:${info}</h3>
<c:catch>处理异常

<c:if>条件判断

<c:if test="${10<30}" var = "res">    <h1>正确</h1></c:if>

<c:forEach>

<body>  <%  String info[] = {"a","b","c","d","e"};  pageContext.setAttribute("ref", info);   %>   <h2>    <c:forEach items = "${ref}" var = "i" step = "2">    ${i},    </c:forEach>   </h2></body>

c标签的使用比较广泛。


SQL标签库

这个基本不用但是稍微做个笔记好了




《Java Web开发实战经典--基础篇》笔记
0 0