📄 simple.jsp
字号:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<jsp:useBean id="now" class="java.util.Date" />
<fmt:setLocale value="zh-cn" />
<%@ page import="java.util.*"%>
<html>
<head>
<title>JSTL: 这里是一个简单的JSTL应用</title>
</head>
<body bgcolor="#FFFFFF">
<h3>这里是一个简单的JSTL应用</h3>
<%
Collection customers=new ArrayList();
customers.add(new String("guest1"));
customers.add(new String("guest2"));
customers.add(new String("guest3"));
//设置customers为request的属性。
request.setAttribute("customers",customers);
%>
<h4>Customers in the request:</h4>
<c:set var="customer" scope="session" value="${requestScope.customers}"/>
<c:forEach var="customer" items="${customers}">
<c:out value="${customer}"/><br>
</c:forEach>
<br>
现在的时间是:
<br>
<fmt:timeZone value="GMT">
<fmt:formatDate value="${now}" type="both" dateStyle="full"
timeStyle="full"/>
</fmt:timeZone>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -