View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbDateLabelTag.java,v 1.22 2006/01/13 13:38:50 hkollmann Exp $
3    * $Revision: 1.22 $
4    * $Date: 2006/01/13 13:38:50 $
5    *
6    * DbForms - a Rapid Application Development Framework
7    * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8    *
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation; either
12   * version 2.1 of the License, or (at your option) any later version.
13   *
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the Free Software
21   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   */
23  
24  package org.dbforms.taglib;
25  
26  import org.dbforms.util.Util;
27  
28  import javax.servlet.jsp.JspException;
29  
30  
31  
32  /***
33   * Philip Grunikiewicz 2001-05-14 This class inherits from DbLabelTag.  It
34   * allows a developer to specify the displayed date format.
35   */
36  public class DbDateLabelTag extends DbLabelTag
37     implements javax.servlet.jsp.tagext.TryCatchFinally {
38  
39     /***
40      * Philip Grunikiewicz 2001-05-14  If user has specified a date format - use
41      * it!
42      *
43      * @return DOCUMENT ME!
44      */
45     public int doEndTag() throws javax.servlet.jsp.JspException {
46        try {
47           String fieldValue = getFormattedFieldValue();
48  
49           // SM 2003-08-05
50           // if styleClass is present, render a SPAN with text included
51           fieldValue = escapeHTML(fieldValue);
52  
53           String s = prepareStyles();
54  
55           if (Util.isNull(s)) {
56              pageContext.getOut()
57                         .write(fieldValue);
58           } else {
59              pageContext.getOut()
60                         .write("<span " + s + ">" + fieldValue + "</span>");
61           }
62        } catch (Exception e) {
63           throw new JspException("Error: " + e.getMessage());
64        }
65  
66        return EVAL_PAGE;
67     }
68  
69  
70     /***
71      * DOCUMENT ME!
72      */
73     public void doFinally() {
74        super.doFinally();
75     }
76  }