1 16 17 package org.apache.taglibs.standard.tag.common.fmt; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.PageContext ; 21 import javax.servlet.jsp.jstl.core.Config; 22 import javax.servlet.jsp.jstl.fmt.LocalizationContext; 23 import javax.servlet.jsp.tagext.TagSupport ; 24 25 import org.apache.taglibs.standard.tag.common.core.Util; 26 27 33 34 public abstract class SetBundleSupport extends TagSupport { 35 36 37 40 protected String basename; 42 43 46 private int scope; private String var; 49 50 53 public SetBundleSupport() { 54 super(); 55 init(); 56 } 57 58 private void init() { 59 basename = null; 60 scope = PageContext.PAGE_SCOPE; 61 } 62 63 64 67 public void setVar(String var) { 68 this.var = var; 69 } 70 71 public void setScope(String scope) { 72 this.scope = Util.getScope(scope); 73 } 74 75 76 79 public int doEndTag() throws JspException { 80 LocalizationContext locCtxt = 81 BundleSupport.getLocalizationContext(pageContext, basename); 82 83 if (var != null) { 84 pageContext.setAttribute(var, locCtxt, scope); 85 } else { 86 Config.set(pageContext, Config.FMT_LOCALIZATION_CONTEXT, locCtxt, 87 scope); 88 } 89 90 return EVAL_PAGE; 91 } 92 93 public void release() { 95 init(); 96 } 97 } 98 | Popular Tags |