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.Locale ; 38 39 42 public class SetLocaleTag extends TagSupport { 43 private static L10N L = new L10N(SetBundleTag.class); 44 45 private Object _value; 46 private String _variant; 47 private String _scope; 48 49 52 public void setValue(Object value) 53 { 54 _value = value; 55 } 56 57 60 public void setVariant(String variant) 61 { 62 _variant = variant; 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 Locale locale = null; 82 83 if (_value instanceof Locale ) { 84 locale = (Locale ) _value; 85 } 86 else if (_value instanceof String ) { 87 locale = pc.getLocale((String ) _value, _variant); 88 } 89 90 CoreSetTag.setValue(pc, Config.FMT_LOCALE, _scope, locale); 91 92 return SKIP_BODY; 93 } 94 } 95 | Popular Tags |