simple.jsp

来自「一个超市管理系统,提供一些基本简单的操作,JSP+APACHE+ORCALE实现」· JSP 代码 · 共 42 行

JSP
42
字号
<%@ 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 + =
减小字号Ctrl + -
显示快捷键?