View Javadoc
1 package com.gotjava.web.taglibs.calendar;
2
3 import javax.servlet.jsp.tagext.TagSupport;
4 import javax.servlet.jsp.JspTagException;
5 import javax.servlet.jsp.JspWriter;
6 import java.io.IOException;
7 import java.util.Date;
8 import java.text.SimpleDateFormat;
9
10 /***
11 * Created by IntelliJ IDEA.
12 * User: farra
13 * Date: Apr 2, 2003
14 * Time: 6:43:58 PM
15 * To change this template use Options | File Templates.
16 */
17 public class DateTag extends TagSupport{
18
19 private String m_format;
20 private String m_property = "currentDate";
21
22 private SimpleDateFormat m_dateFormat;
23
24 public int doEndTag() throws JspTagException
25 {
26 m_dateFormat = new SimpleDateFormat(m_format);
27
28 Date startDate = (Date) pageContext.getAttribute(m_property);
29
30 JspWriter out = pageContext.getOut();
31 try
32 {
33 out.write(m_dateFormat.format(startDate));
34
35 }
36 catch (IOException e)
37 {
38 throw new JspTagException("Error writing to page");
39 }
40
41 return EVAL_PAGE;
42 }
43
44 public String getFormat(){
45 return m_format;
46 }
47
48 public void setFormat(String format){
49 m_format = format;
50 }
51
52 public void setProperty(String property){
53 m_property = property;
54 }
55
56 public String getProperty(){
57 return m_property;
58 }
59
60 }
This page was automatically generated by Maven