1 28 29 package com.caucho.jstl.rt; 30 31 import com.caucho.jsp.PageContextImpl; 32 import com.caucho.util.L10N; 33 34 import javax.servlet.jsp.JspException ; 35 import javax.servlet.jsp.jstl.core.Config; 36 import javax.servlet.jsp.tagext.TagSupport ; 37 import java.util.TimeZone ; 38 39 42 public class FmtSetTimeZoneTag extends TagSupport { 43 private static L10N L = new L10N(FmtSetTimeZoneTag.class); 44 45 private Object _value; 46 private String _var; 47 private String _scope; 48 49 52 public void setValue(Object value) 53 { 54 _value = value; 55 } 56 57 60 public void setVar(String var) 61 { 62 _var = var; 63 } 64 65 68 public void setScope(String scope) 69 { 70 _scope = scope; 71 } 72 73 76 public int doStartTag() 77 throws JspException 78 { 79 PageContextImpl pc = (PageContextImpl) pageContext; 80 81 TimeZone timeZone = null; 82 83 if (_value instanceof TimeZone ) { 84 timeZone = (TimeZone ) _value; 85 } 86 else if (_value instanceof String ) { 87 String string = (String ) _value; 88 string = string.trim(); 89 90 if (string.equals("")) 91 timeZone = TimeZone.getTimeZone("GMT"); 92 else 93 timeZone = TimeZone.getTimeZone(string); 94 } 95 else 96 timeZone = TimeZone.getTimeZone("GMT"); 97 98 String var = _var; 99 if (var == null) 100 var = Config.FMT_TIME_ZONE; 101 102 CoreSetTag.setValue(pc, var, _scope, timeZone); 103 104 return SKIP_BODY; 105 } 106 } 107 | Popular Tags |