JSTL标签库简介
2016-04-08 09:47
375 查看
核心标签库
http://java.sun.com/jsp/jstl/core
<c:catch>,<c:url>的使用
<c:if>,<c:when>,<c:otherwise>,<c:choose>的使用
http://java.sun.com/jsp/jstl/core
<c:catch>,<c:url>的使用
<!-- 捕获异常 --> <c:catch var="exception"> <% int a=1,b=0; out.print(a/b); %> </c:catch> <c:out value="${exception }"/> <!-- 建立URL --> <a href="<c:url value="//index.jsp"/>">哈哈哈</a> <a href="/index.jsp">哈哈哈</a> <!-- 使用其他Web应用URL --> <c:url value="/index.jsp" var="add" context="/MyMessage"/> <a href="${add }">呵呵</a>
<c:if>,<c:when>,<c:otherwise>,<c:choose>的使用
<% Calendar now=Calendar.getInstance(); Integer hour=new Integer(now.get(Calendar.HOUR_OF_DAY));//获取小时 request.setAttribute("time", hour); %> <c:if test="${time>=0&&time<=11 }"> <c:set value="早上好!" var="sayhello"/> </c:if> <c:if test="${time>=12&&time<=17 }"> <c:set value="下午好!" var="sayhello"/> </c:if> <c:if test="${time>=18&&time<=23 }"> <c:set value="晚上好!" var="sayhello"/> </c:if> <c:out value="${sayhello }"/> <c:choose> <c:when test="${time>=0&&time<=11 }"> <c:set value="moring" var="sayhello"/> </c:when> <c:when test="${time>=12&&time<=17 }"> <c:set value="noon" var="sayhello"/> </c:when> <c:otherwise> <c:set value="night" var="sayhello"/> </c:otherwise> </c:choose> <c:out value="${sayhello }"/>
相关文章推荐
- ExtJS实现Excel导出
- 模块化JavaScript设计模式(一)
- js 截取字符串
- JSON资料整理(转)
- 页面缓存js问题解决
- 用js导出页面table到excel表中
- 关于fancybox大图片显示位置不准确的问题解决方案
- JS异步编程
- JavaScript代码实现左右上下自动晃动自动移动
- ExtJS小技巧
- 【转载】js--(function(){…})()立即执行函数写法理解
- JS表单验证的代码(常用)
- JS学习2
- 【Ghost Blog】如何给Ghost Blog添加背景音乐
- 关于Odoo 8.0 jsonrpc的调查
- JavaScript事件代理和委托详解
- js实现几秒页面跳转的几种方式
- JavaScript的写类方式(6)
- 手机淘宝列表页面 的js调用展示
- JavaScript学习基础-标签放置位置