1 28 29 package com.caucho.jstl.el; 30 31 import com.caucho.el.Expr; 32 import com.caucho.jsp.PageContextImpl; 33 import com.caucho.util.L10N; 34 35 import javax.el.ELException; 36 import javax.servlet.jsp.JspException ; 37 import javax.servlet.jsp.jstl.core.Config; 38 import javax.servlet.jsp.tagext.TagSupport ; 39 import java.util.TimeZone ; 40 41 44 public class SetTimeZoneTag extends TagSupport { 45 private static L10N L = new L10N(SetTimeZoneTag.class); 46 47 private Expr _valueExpr; 48 private String _var; 49 private String _scope; 50 51 54 public void setValue(Expr value) 55 { 56 _valueExpr = value; 57 } 58 59 62 public void setVar(String var) 63 { 64 _var = var; 65 } 66 67 70 public void setScope(String scope) 71 { 72 _scope = scope; 73 } 74 75 78 public int doStartTag() 79 throws JspException  80 { 81 try { 82 PageContextImpl pageContext = (PageContextImpl) this.pageContext; 83 84 Object valueObj = _valueExpr.evalString(pageContext.getELContext()); 85 TimeZone timeZone = null; 86 87 if (valueObj instanceof TimeZone ) { 88 timeZone = (TimeZone ) valueObj; 89 } 90 else if (valueObj instanceof String ) { 91 String string = (String ) valueObj; 92 string = string.trim(); 93 94 if (string.equals("")) 95 timeZone = TimeZone.getTimeZone("GMT"); 96 else 97 timeZone = TimeZone.getTimeZone(string); 98 } 99 else 100 timeZone = TimeZone.getTimeZone("GMT"); 101 102 String var = _var; 103 if (var == null) 104 var = Config.FMT_TIME_ZONE; 105 106 CoreSetTag.setValue(pageContext, var, _scope, timeZone); 107 108 return SKIP_BODY; 109 } catch (ELException e) { 110 throw new JspException (e); 111 } 112 } 113 } 114
| Popular Tags
|