sun公司的jstl标签库

 1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
 2 <%@ page language="java" import="cn.itcast.*" %>
 3 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 4 
 5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 6 
 7 <html>
 8   <head>
 9     
10     <title>Zero</title>
11   
12   </head>
13  
14   <body>
15       <c:out value="aaaa"></c:out>
16       <br/>---------------------------------------------<br/>
17       <c:set var="data" value="xxxx"  scope="page" />
18       ${data }    
19       
20       <%
21           Map map = new HashMap();
22           request.setAttribute("map",map);
23       %>
24       <c:set property="dd" value="zero" target="${map}"></c:set>
25       ${map.dd }
26       
27       
28       <br/>---------------------------------------------<br/>
29       <c:catch var="myex">
30           <%
31               int x = 10/0;
32           %>
33       </c:catch>
34       ${myex.message }
35       
36       <br/>---------------------------------------------<br/>
37       
38       <c:if var="zero" test="${user==null}" scope="page">
39       
40       </c:if>
41       ${zero }
42       <br/>---------------------------------------------<br/>
43       <%
44           List list = new ArrayList();
45           list.add("zero");
46           list.add("one");
47           list.add("two");
48           list.add("thress");
49           
50           request.setAttribute("list",list);
51       %>
52       
53       <c:forEach var="str" items="${list}">
54           ${str }
55       </c:forEach>
56       <c:forEach var="num" begin="1" end="9" step="2">
57           ${num }
58       </c:forEach>
59       <br/>---------------------------------------------<br/>
60       <%
61           List list1 = new ArrayList();
62           list1.add("zero");
63           list1.add("one");
64           list1.add("two");
65           list1.add("thress");
66           list1.add("four");
67           list1.add("five");
68           list1.add("six");
69           list1.add("seven");
70           
71           request.setAttribute("list1",list1);
72       %>
73       
74       <style>
75           .odd{background-color:#FF99FF;}
76           .even{background-color:#FF6633;}
77           tr.hover{background-color:#0000FF;}
78       </style>
79       <table border="1" width="20%">
80           <c:forEach var="str" items="${list1}" varStatus="status">
81               <tr class="${status.count%2==0?‘even‘:‘odd‘ }">
82                   <td>${str }</td>
83               </tr>
84           </c:forEach>
85       </table>
86       
87       <br/>---------------------------------------------<br/>
88       <c:url var="url" value="www.baidu.com"></c:url>
89       <a href="${url }">BUY</a>
90       
91       <c:url var="index" value="index.jsp"></c:url>
92       <a href="${index} ">B</a>
93        
94   </body>
95 </html>
JSTLDEMO

 

sun公司的jstl标签库,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。