1 16 17 package org.apache.taglibs.standard.tag.el.fmt; 18 19 import java.util.Locale ; 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.ParseDateSupport; 25 import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; 26 27 33 34 public class ParseDateTag extends ParseDateSupport { 35 36 39 private String value_; private String type_; private String dateStyle_; private String timeStyle_; private String pattern_; private String timeZone_; private String parseLocale_; 47 48 51 56 public ParseDateTag() { 57 super(); 58 init(); 59 } 60 61 62 65 public int doStartTag() throws JspException { 67 68 evaluateExpressions(); 70 71 return super.doStartTag(); 73 } 74 75 public void release() { 77 super.release(); 78 init(); 79 } 80 81 82 85 public void setValue(String value_) { 87 this.value_ = value_; 88 this.valueSpecified = true; 89 } 90 91 public void setType(String type_) { 93 this.type_ = type_; 94 } 95 96 public void setDateStyle(String dateStyle_) { 98 this.dateStyle_ = dateStyle_; 99 } 100 101 public void setTimeStyle(String timeStyle_) { 103 this.timeStyle_ = timeStyle_; 104 } 105 106 public void setPattern(String pattern_) { 108 this.pattern_ = pattern_; 109 } 110 111 public void setTimeZone(String timeZone_) { 113 this.timeZone_ = timeZone_; 114 } 115 116 public void setParseLocale(String parseLocale_) { 118 this.parseLocale_ = parseLocale_; 119 } 120 121 122 125 private void init() { 127 value_ = type_ = dateStyle_ = timeStyle_ = pattern_ = timeZone_ = null; 129 parseLocale_ = null; 130 } 131 132 private void evaluateExpressions() throws JspException { 134 141 142 if (value_ != null) { 144 value = (String ) ExpressionEvaluatorManager.evaluate( 145 "value", value_, String .class, this, pageContext); 146 } 147 148 if (type_ != null) { 150 type = (String ) ExpressionEvaluatorManager.evaluate( 151 "type", type_, String .class, this, pageContext); 152 } 153 154 if (dateStyle_ != null) { 156 dateStyle = (String ) ExpressionEvaluatorManager.evaluate( 157 "dateStyle", dateStyle_, String .class, this, pageContext); 158 } 159 160 if (timeStyle_ != null) { 162 timeStyle = (String ) ExpressionEvaluatorManager.evaluate( 163 "timeStyle", timeStyle_, String .class, this, pageContext); 164 } 165 166 if (pattern_ != null) { 168 pattern = (String ) ExpressionEvaluatorManager.evaluate( 169 "pattern", pattern_, String .class, this, pageContext); 170 } 171 172 if (timeZone_ != null) { 174 timeZone = ExpressionEvaluatorManager.evaluate( 175 "timeZone", timeZone_, Object .class, this, pageContext); 176 } 177 178 if (parseLocale_ != null) { 180 Object obj = ExpressionEvaluatorManager.evaluate( 181 "parseLocale", parseLocale_, Object .class, this, pageContext); 182 if (obj != null) { 183 if (obj instanceof Locale ) { 184 parseLocale = (Locale ) obj; 185 } else { 186 String localeStr = (String ) obj; 187 if (!"".equals(localeStr)) { 188 parseLocale = SetLocaleSupport.parseLocale(localeStr); 189 } 190 } 191 } 192 } 193 } 194 } 195 | Popular Tags |