zoukankan      html  css  js  c++  java
  • 【JSP 标签】格式化日期

    在使用JSP开发页面时,java.util.Date在JSP页面直接输出的格式不好看,需要进行格式化。

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <c:set var="rootPath"  value="${pageContext.request.contextPath}" scope="request"/>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>缴费标志</th>
                    <th>缴费时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <c:forEach items="${userAcctList}" begin="0" step="1" var="userAcct">
                <tr>
                    <td>
                        <c:if test="${userAcct.payedFlag==1}">
                            <img alt="已交费" src="/img/icon/smile.jpeg">
                        </c:if>
                        <c:if test="${userAcct.payedFlag!=1}">
                            <img alt="未交费" src="/img/icon/han.jpg">
                        </c:if>
                    </td>
                    <!-- 日期格式化标签 -->
                    <td><fmt:formatDate pattern="yyyy-MM-dd" value="${userAcct.payTime}"/></td>
                    <td>
                        <c:if test="${userAcct.payedFlag!=1}">
                            <a href="#">交费</a>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </body>
    </html>
  • 相关阅读:
    BZOJ1040: [ZJOI2008]骑士
    酱油记:GDKOI2018
    BZOJ1800: [Ahoi2009]fly 飞行棋
    BZOJ3894: 文理分科
    树链剖分
    文件格式问题
    10.23模拟赛
    snakes
    数据结构题目
    jquery&nbsp;easyui&nbsp;datebox&nbsp;的使用&nbsp;.
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/6804614.html
Copyright © 2011-2022 走看看