forked from csula/cs3220-spring-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjstl-example.jsp
68 lines (52 loc) · 1.52 KB
/
jstl-example.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%-- Import the JSTL --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%-- import the custom tag for HelloTag --%>
<%@ taglib prefix="cs3220" uri="custom.tld"%>
<%@ taglib prefix="cs3220-add" uri="addTag.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" href="<c:url value='/app.css' />">
</head>
<body>
<c:out value="Hello JSTL" />
${user.firstName}
<c:if test="${user.firstName == 'Eric'}">
Hello Eric
</c:if>
<c:choose>
<c:when test="${day == 'tue'}">
Tuesday
</c:when>
<c:when test="${day == 'wed'}">
<%-- Find day variable and replace day --%>
<%-- ${"some" == 'wed'} --%>
<%-- ${false} --%>
<%-- false --%>
Wednesday</c:when>
<c:when test="${day == 'thr'}">
Thursday
</c:when>
<c:otherwise>Friday</c:otherwise>
</c:choose>
<ul>
<c:forEach items="${numbers}" var="number">
<li>${number}</li>
</c:forEach>
</ul>
<ul>
<c:forEach items="${numbers}" var="number"
varStatus="status">
<li>${status.index}: ${number}</li>
</c:forEach>
</ul>
Current Date: <fmt:formatDate value="${date}" type="time" />
Hello custom tag: <br>
<cs3220:Hello/>
<cs3220-add:add op1="3" op2="5" />
</body>
</html>