博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jstl的core标签库
阅读量:4229 次
发布时间:2019-05-26

本文共 1250 字,大约阅读时间需要 4 分钟。

    action参数为:<c:out value="${action }" default="No parameter named 'action' found"/>
    <c:if test="${param }=='add'}">
        Hello
    </c:if>
    if标签没有else的功能,代替方案
    <c:choose>
        <c:when test="${empty param }">
            when标签的输出
        </c:when>
        <c:otherwise>
            otherwise标签的输出
        </c:otherwise>
    </c:choose>
    用来迭代集合
    <c:forEach var="num" begin="2" end="20" step="2">
        <div>${num}</div>
    </c:forEach>
<%
    List<Integer> s=new ArrayList<Integer>();
    s.add(1);
    s.add(2);
    s.add(3);
    request.setAttribute("s",s);
%>
<c:forEach items="${s }" var="a">    
    ${a}&nbsp;
</c:forEach>
遍历字符串
<c:forTokens items="Jane,Tomi,Andy,Hedrix,McCartney" delims="," var="item" varStatus="varStatus">
    ${varStatus.index }&nbsp;
    ${item }
</c:forTokens>
set标签实现存值,既可以声明一个不存在的对象,也可以,修改一个已经存在对象的某个属性
<c:set var="totalCount" value="1" scope="page"/>
<!-- target作用用来操作javabean
<c:set target="${person}" property="name" value="${param.name}"/>
<c:set target="${map}" property="name" value="${param.name}"/>
 -->
<!--
<c:remove/>标签用来移除page、request,session,application中的数据
<c:remove var="somemap"/>
 -->
捕捉异常
<c:redirect url="https://www.baidu.com"/>
相对路径
<c:redirect url="/index.jsp" context="/jstl"/>
<c:param/>标签传值
<c:redirect url="/index.jsp" context="/jstl">
    <c:param name="wd" value="音乐"/>
    <c:param name="cl" value="2"/>
</c:redirect>

转载地址:http://yvjqi.baihongyu.com/

你可能感兴趣的文章
git常用命令总结
查看>>
Protobuf了解一下?
查看>>
超越Selenium的存在---Pyppeteer
查看>>
复仇者联盟4:终局之战剧透
查看>>
Msgpack有没有兴趣了解一下?
查看>>
探索一家神秘的公司
查看>>
PDF转Word完全免费?这么好的事情我怎么不知道????
查看>>
数据解读---B站火过蔡徐坤的“鬼畜“区巨头们
查看>>
Squid代理服务器搭建亿级爬虫IP代理池
查看>>
JupyterNotebook‘s Magic
查看>>
在Linux 上部署Jenkins和项目
查看>>
Python+requests+unittest+excel实现接口自动化测试框架
查看>>
那些年我们听过的互联网公司的套路?
查看>>
谈谈python里面那些高级函数
查看>>
40行代码带你免费看《海贼王-和之国》篇章
查看>>
搭建炫酷的服务器监控平台
查看>>
垃圾分类:人机搭配,干活不累
查看>>
Nginx
查看>>
Memcached,session共享
查看>>
Tomcat,varnish
查看>>