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>
  • 相关阅读:
    C#Webform 控件
    C#Webform
    MVC Razor 语法
    input file 添加
    ajax
    jquery动画
    jquery选择器,事件 dom操作
    linq 复杂查询
    webform(linq增删改查)
    asp.net内置对象
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/6804614.html
Copyright © 2011-2022 走看看