亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? formattag.java

?? jakarta-taglibs
?? JAVA
字號(hào):
/*
 * Copyright 1999,2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.taglibs.datetime;

import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

/**
 * JSP Tag <b>format</b>, used to format a Date for display.
 * <p>
 * The Date as a long in milliseconds is obtained from the body of the tag.
 * <p>
 * Uses the optional attribute <b>pattern</b> as the time pattern
 * string to use when formatting the Date.
 * <p>
 * The optional attribute <b>timeZone</b> can be set to the id of
 * a timeZone script varaible so that the Date if adjusted for 
 * that timeZone.
 * <p>
 * If the optional attribute <b>locale</b> is true, the Date
 * is formatted for the clients locale if known.
 * <p>
 * The optional attribute <b>date</b> can be set to a
 * Date object using a runtime expression value.  If set,
 * date will be used instead of the tag body.
 * <p>
 * The optional attribute <b>default</b> can be set to a
 * default string to output if the date object doesn't exist
 * or the tag body is not a valid date.  If no default is set,
 * the string "Invalid Date" is output.
 * <p>
 * The optional attribute <b>localeRef</b> can be used to specify
 * the name of a page, session, application, or request scope attribute
 * of type java.util.Locale to use.
 * <p>
 * JSP Tag Lib Descriptor
 * <p><pre>
 * &lt;name&gt;format&lt;/name&gt;
 * &lt;tagclass&gt;org.apache.taglibs.datetime.FormatTag&lt;/tagclass&gt;
 * &lt;bodycontent&gt;JSP&lt;/bodycontent&gt;
 * &lt;info&gt;Formats a date for output.&lt;/info&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;pattern&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;patternId&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;timeZone&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;locale&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;date&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;default&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;localeRef&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 *   &lt;attribute&gt;
 *     &lt;name&gt;symbolsRef&lt;/name&gt;
 *     &lt;required&gt;false&lt;/required&gt;
 *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
 *   &lt;/attribute&gt;
 * </pre>
 *
 * @author Glenn Nielsen
 * @author Mark Femal
 */

public class FormatTag extends BodyTagSupport
{

    // format tag attributes

    // Optional attribute, use users locale if known when formatting date
    private boolean locale_flag = false;
    // Optional attribute, time pattern string to use when formatting date
    private String pattern = null;
    // Optional attribute, name of script variable to use as pattern
    private String patternid = null;
    // Optional attribute, timeZone script variable id to use when formatting date
    private String timeZone_string;
    // Optional attribute, date object from rtexprvalue
    private Date date = null;
    // Optional attribute, the default text if the tag body or date given is invalid/null
    private String default_text = "Invalid Date";
    // Optional attribute, the name of an attribute which contains the Locale
    private String localeRef = null;
    // Optional attribute, name of script variable to use as date symbols source
    private String symbolsRef = null;

    // format tag invocation variables

    // The symbols object
    private DateFormatSymbols symbols = null;
    // The date to be formatted an output by tag
    private Date output_date = null;

    /**
     * Method called at start of tag, always returns EVAL_BODY_TAG
     *
     * @return EVAL_BODY_TAG
     */
    public final int doStartTag() throws JspException
    {
        output_date = date;
        return EVAL_BODY_TAG;
    }

    /**
     * Method called at end of format tag body.
     *
     * @return SKIP_BODY
     */
    public final int doAfterBody() throws JspException
    {
        // Use the body of the tag as input for the date
        BodyContent body = getBodyContent();
        String s = body.getString().trim();  
        // Clear the body since we will output only the formatted date
        body.clearBody();
        if( output_date == null ) {
            long time;
            try {
                time = Long.valueOf(s).longValue();
                output_date = new Date(time);
            } catch(NumberFormatException nfe) {
            }
        }

        return SKIP_BODY;
    }

    /**
     * Method called at end of Tag
     *
     * @return EVAL_PAGE
     */
    public final int doEndTag() throws JspException
    {
        String date_formatted = default_text;

        if (output_date != null) {
            // Get the pattern to use
            SimpleDateFormat sdf;
            String pat = pattern;

            if (pat == null && patternid != null) {
                Object attr = pageContext.findAttribute(patternid);
                if (attr != null)
                    pat = attr.toString();
            }

            if (pat == null) {
                sdf = new SimpleDateFormat();
                pat = sdf.toPattern();
            }

            // Get a DateFormatSymbols
            if (symbolsRef != null) {
                symbols = (DateFormatSymbols) pageContext.findAttribute(symbolsRef);
                if (symbols == null) {
                    throw new JspException(
                            "datetime format tag could not find dateFormatSymbols for symbolsRef \"" +
                            symbolsRef + "\".");
                }
            }

            // Get a SimpleDateFormat using locale if necessary
            if (localeRef != null) {
                Locale locale = (Locale) pageContext.findAttribute(localeRef);
                if (locale == null) {
                    throw new JspException(
                            "datetime format tag could not find locale for localeRef \"" +
                            localeRef + "\".");
                }

                sdf = new SimpleDateFormat(pat, locale);
            } else if (locale_flag) {
                sdf = new SimpleDateFormat(pat,
                        (Locale) pageContext.getRequest().getLocale());
            } else if (symbols != null) {
                sdf = new SimpleDateFormat(pat,
                        symbols);
            } else {
                sdf = new SimpleDateFormat(pat);
            }

            // See if there is a timeZone
            if (timeZone_string != null) {
                TimeZone timeZone =
                        (TimeZone) pageContext.getAttribute(timeZone_string,
                                PageContext.SESSION_SCOPE);
                if (timeZone == null) {
                    throw new JspTagException("Datetime format tag timeZone " +
                            "script variable \"" + timeZone_string +
                            " \" does not exist");
                }
                sdf.setTimeZone(timeZone);
            }

            // Format the date for display
            date_formatted = sdf.format(output_date);
        }

        try {
            pageContext.getOut().write(date_formatted);
        } catch (Exception e) {
            throw new JspException("IO Error: " + e.getMessage());
        }

        return EVAL_PAGE;
    }

    public void release()
    {
        super.release();
        locale_flag = false;
        pattern = null;
        patternid = null;
        date = null;
        localeRef = null;
        symbolsRef = null;
        symbols = null;
    }

    /**
     * Locale flag, if set to true, format date
     * for client's preferred locale if known.
     *
     * @param boolean use users locale, true or false
     */
    public final void setLocale(boolean flag)
    {
        locale_flag = flag;
    }

    /**
     * Set the time zone to use when formatting date.
     *
     * Value must be the name of a <b>timeZone</b> tag script
     * variable ID.
     *
     * @param String name of timeZone to use
     */
    public final void setTimeZone(String tz)
    {
        timeZone_string = tz;
    }

    /**
     * Set the pattern to use when formatting Date.
     *
     * @param String SimpleDateFormat style time pattern format string
     */
    public final void setPattern(String str)
    {
        pattern = str;
    }

    /**
     * Set the pattern to use when parsing Date using a script variable
     * attribute.
     * 
     * @param String name of script variable attribute id
     */
    public final void setPatternId(String str)
    {   
        patternid = str;
    }

    /**
     * Set the date to use (overrides tag body) for formatting
     *
     * @param Date to use for formatting (could be null)
     */
    public final void setDate(Date date)
    {
        this.date = date;
    }

    /**
     * Set the default text if an invalid date or no tag body is given
     *
     * @param String to use as default text
     */
    public final void setDefault(String default_text)
    {
        this.default_text = default_text;
    }

    /**
     * Provides a key to search the page context for in order to get the
     * java.util.Locale to use.
     *
     * @param String name of locale attribute to use
     */
    public void setLocaleRef(String value)
    {
        localeRef = value;
    }

    /**
     * Provides a key to search the page context for in order to get the
     * java.text.DateFormatSymbols to use
     *
     * @param symbolsRef
     */
    public void setSymbolsRef(String symbolsRef) throws JspException
    {
        this.symbolsRef = symbolsRef;
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99九九99精品| 奇米888四色在线精品| 亚洲婷婷国产精品电影人久久| 欧美一区二区视频在线观看2022| 色天天综合色天天久久| 91小视频免费观看| 91免费版pro下载短视频| 91在线视频免费91| 色一区在线观看| 欧美性高清videossexo| 欧美日韩国产一二三| 国产精品素人视频| 国内精品国产成人国产三级粉色 | 亚洲午夜三级在线| 亚洲人成网站在线| 亚洲综合无码一区二区| 性欧美大战久久久久久久久| 五月激情综合婷婷| 美女视频黄频大全不卡视频在线播放| 久久99日本精品| 国产福利电影一区二区三区| 成人av午夜影院| 欧美中文字幕一区二区三区亚洲| 欧美日韩在线播放三区四区| 欧美一级片免费看| 国产欧美综合在线观看第十页 | 蜜臀av性久久久久蜜臀aⅴ四虎| 蜜桃av一区二区| 丁香啪啪综合成人亚洲小说| 91同城在线观看| 欧美日韩1234| 久久久99精品免费观看不卡| 中文字幕一区二区不卡| 亚洲成av人片一区二区梦乃| 久久国产尿小便嘘嘘尿| 成人av第一页| 在线不卡a资源高清| 久久久噜噜噜久噜久久综合| 亚洲视频资源在线| 天堂午夜影视日韩欧美一区二区| 国产一区在线不卡| 一本到不卡免费一区二区| 91精品麻豆日日躁夜夜躁| 亚洲色图在线视频| 亚洲欧洲www| 日本视频一区二区三区| 高清av一区二区| 欧美日韩国产系列| 国产色综合一区| 亚洲国产另类av| 国产在线播放一区| 色欧美日韩亚洲| 精品国精品国产| 亚洲在线视频一区| 国产成人综合在线观看| 欧美日韩国产另类一区| 中文字幕精品一区二区精品绿巨人 | 视频一区中文字幕| 国产福利一区二区三区视频在线 | 欧美日韩一级二级三级| 久久免费电影网| 亚洲成av人片在线观看| 国产高清不卡一区| 欧美一卡二卡三卡| 亚洲精品综合在线| 国产成人av福利| 日韩手机在线导航| 亚洲自拍偷拍av| 成人亚洲一区二区一| 日韩一级黄色片| 亚洲午夜私人影院| 91一区二区在线| 国产欧美va欧美不卡在线| 婷婷丁香久久五月婷婷| 成人18精品视频| 欧美大片国产精品| 日日夜夜精品视频免费| 91极品视觉盛宴| 国产精品麻豆99久久久久久| 韩国视频一区二区| 制服视频三区第一页精品| 亚洲激情欧美激情| 99久久婷婷国产精品综合| 精品播放一区二区| 另类调教123区| 在线不卡a资源高清| 亚洲3atv精品一区二区三区| aaa欧美大片| 国产欧美一区二区三区在线老狼| 麻豆成人免费电影| 日韩一区二区三区在线视频| 午夜在线成人av| 欧美亚洲高清一区二区三区不卡| 自拍偷自拍亚洲精品播放| 国产精品一级黄| 久久亚区不卡日本| 黄色成人免费在线| 精品少妇一区二区三区免费观看| 天天操天天综合网| 欧美日韩免费视频| 亚洲国产日韩综合久久精品| 日本福利一区二区| 欧美国产精品专区| 国产a久久麻豆| 国产精品欧美精品| 99久久精品情趣| 日韩毛片精品高清免费| 99re热这里只有精品免费视频| 国产精品黄色在线观看| 99久久综合国产精品| 国产精品美女久久久久aⅴ国产馆| 丁香婷婷综合五月| 卡一卡二国产精品| 日韩激情在线观看| 欧美一区二区三区精品| 日本v片在线高清不卡在线观看| 91麻豆精品国产91久久久使用方法| 亚洲一二三四区| 51久久夜色精品国产麻豆| 青青草国产成人99久久| 精品国产乱码久久久久久1区2区| 精品一区二区三区影院在线午夜 | 337p日本欧洲亚洲大胆精品| 国产综合色视频| 国产精品麻豆视频| 色婷婷久久久亚洲一区二区三区 | 麻豆精品一二三| 久久亚洲综合色| 不卡av在线网| 亚洲自拍偷拍av| 欧美一区二区在线视频| 韩国成人在线视频| 国产精品视频线看| 欧美无砖专区一中文字| 看电视剧不卡顿的网站| 日本一区二区成人在线| 在线精品视频一区二区| 蜜桃视频一区二区| 亚洲国产精品99久久久久久久久| 91农村精品一区二区在线| 婷婷一区二区三区| 欧美韩国一区二区| 欧美三级电影网站| 老司机精品视频在线| 中文字幕免费在线观看视频一区| 在线亚洲高清视频| 激情综合色综合久久综合| 国产精品久线在线观看| 欧美日韩成人在线一区| 国产乱码一区二区三区| 亚洲国产精品国自产拍av| 欧美日韩一区国产| 国产精品一区三区| 亚洲成在线观看| 国产午夜精品一区二区三区视频| 在线精品视频小说1| 国产黄色精品网站| 视频一区二区欧美| 国产精品萝li| 欧美mv日韩mv亚洲| 欧美在线免费观看亚洲| 国产精品一区免费在线观看| 午夜精品久久久久久久99水蜜桃| 国产欧美日韩麻豆91| 欧美日韩国产一级片| 99久久精品国产观看| 麻豆一区二区99久久久久| 亚洲欧美精品午睡沙发| 久久综合狠狠综合久久综合88| 在线看国产日韩| aa级大片欧美| 国产精品一区二区三区99| 日韩高清在线电影| 一区二区不卡在线播放| 国产色婷婷亚洲99精品小说| 91精品国产综合久久精品图片| 99久久er热在这里只有精品15| 麻豆久久久久久久| 亚洲va韩国va欧美va| 日韩一区中文字幕| 国产午夜亚洲精品理论片色戒| 日韩午夜激情av| 欧美日韩中字一区| 成人动漫一区二区在线| 国产一区不卡视频| 日韩成人av影视| 香蕉成人啪国产精品视频综合网| 亚洲精品国产无套在线观| 欧美激情一区二区三区四区 | 日本系列欧美系列| 亚洲小说欧美激情另类| 专区另类欧美日韩| 国产精品久久三区| 久久激情五月婷婷| 精品捆绑美女sm三区| 91精品国产综合久久小美女| 欧美猛男gaygay网站| 欧美综合天天夜夜久久| 91国产视频在线观看| 一本大道久久a久久精品综合|