1 16 17 package org.apache.taglibs.standard.tag.el.fmt; 18 19 import java.util.Date ; 20 21 import javax.servlet.jsp.JspException ; 22 23 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 24 import org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport; 25 26 32 33 public class FormatDateTag extends FormatDateSupport { 34 35 38 private String value_; private String type_; private String dateStyle_; private String timeStyle_; private String pattern_; private String timeZone_; 45 46 49 54 public FormatDateTag() { 55 super(); 56 init(); 57 } 58 59 60 63 public int doStartTag() throws JspException { 65 66 evaluateExpressions(); 68 69 return super.doStartTag(); 71 } 72 73 public void release() { 75 super.release(); 76 init(); 77 } 78 79 80 83 public void setValue(String value_) { 85 this.value_ = value_; 86 } 87 88 public void setType(String type_) { 90 this.type_ = type_; 91 } 92 93 public void setDateStyle(String dateStyle_) { 95 this.dateStyle_ = dateStyle_; 96 } 97 98 public void setTimeStyle(String timeStyle_) { 100 this.timeStyle_ = timeStyle_; 101 } 102 103 public void setPattern(String pattern_) { 105 this.pattern_ = pattern_; 106 } 107 108 public void setTimeZone(String timeZone_) { 110 this.timeZone_ = timeZone_; 111 } 112 113 114 117 private void init() { 119 value_ = type_ = dateStyle_ = timeStyle_ = pattern_ = timeZone_ = null; 121 } 122 123 private void evaluateExpressions() throws JspException { 125 132 133 value = (Date ) ExpressionEvaluatorManager.evaluate( 135 "value", value_, Date .class, this, pageContext); 136 137 if (type_ != null) { 139 type = (String ) ExpressionEvaluatorManager.evaluate( 140 "type", type_, String .class, this, pageContext); 141 } 142 143 if (dateStyle_ != null) { 145 dateStyle = (String ) ExpressionEvaluatorManager.evaluate( 146 "dateStyle", dateStyle_, String .class, this, pageContext); 147 } 148 149 if (timeStyle_ != null) { 151 timeStyle = (String ) ExpressionEvaluatorManager.evaluate( 152 "timeStyle", timeStyle_, String .class, this, pageContext); 153 } 154 155 if (pattern_ != null) { 157 pattern = (String ) ExpressionEvaluatorManager.evaluate( 158 "pattern", pattern_, String .class, this, pageContext); 159 } 160 161 if (timeZone_ != null) { 163 timeZone = ExpressionEvaluatorManager.evaluate( 164 "timeZone", timeZone_, Object .class, this, pageContext); 165 } 166 } 167 } 168 | Popular Tags |