You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by lu...@apache.org on 2002/04/12 04:11:02 UTC
cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt SetBundleTag.java
luehe 02/04/11 19:11:02
Modified: standard/conf fmt-rt.tld fmt.tld
standard/src/javax/servlet/jsp/jstl/core Config.java
standard/src/javax/servlet/jsp/jstl/fmt LocaleSupport.java
standard/src/org/apache/taglibs/standard/tag/common/fmt
BundleSupport.java LocaleSupport.java
MessageSupport.java
standard/src/org/apache/taglibs/standard/tag/el/fmt
BundleTag.java
Added: standard/src/org/apache/taglibs/standard/tag/common/fmt
SetBundleSupport.java
standard/src/org/apache/taglibs/standard/tag/el/fmt
SetBundleTag.java
standard/src/org/apache/taglibs/standard/tag/rt/fmt
SetBundleTag.java
Log:
Separated out <fmt:bundle>'s config setting capabilities into new <fmt:setBundle> tag
Revision Changes Path
1.18 +17 -2 jakarta-taglibs/standard/conf/fmt-rt.tld
Index: fmt-rt.tld
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/conf/fmt-rt.tld,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- fmt-rt.tld 11 Apr 2002 02:02:35 -0000 1.17
+++ fmt-rt.tld 12 Apr 2002 02:11:02 -0000 1.18
@@ -87,15 +87,30 @@
<tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
<body-content>JSP</body-content>
<description>
- Loads a resource bundle containing localized messages
+ Loads a resource bundle to be used by its tag body
</description>
<attribute>
<name>basename</name>
- <required>true</required>
+ <required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>prefix</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>setBundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Loads a resource bundle and stores it in the named scoped variable or
+ the bundle configuration variable
+ </description>
+ <attribute>
+ <name>basename</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
1.18 +18 -2 jakarta-taglibs/standard/conf/fmt.tld
Index: fmt.tld
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/conf/fmt.tld,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- fmt.tld 11 Apr 2002 01:04:05 -0000 1.17
+++ fmt.tld 12 Apr 2002 02:11:02 -0000 1.18
@@ -23,6 +23,7 @@
timeZone:value
bundle:basename
bundle:prefix
+ setBundle:basename
message:key
message:bundle
param:value
@@ -127,15 +128,30 @@
<tag-class>org.apache.taglibs.standard.tag.el.fmt.BundleTag</tag-class>
<body-content>JSP</body-content>
<description>
- Loads a resource bundle containing localized messages
+ Loads a resource bundle to be used by its tag body
</description>
<attribute>
<name>basename</name>
- <required>true</required>
+ <required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>prefix</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>setBundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.SetBundleTag</tag-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Loads a resource bundle and stores it in the named scoped variable or
+ the bundle configuration variable
+ </description>
+ <attribute>
+ <name>basename</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
1.2 +8 -0 jakarta-taglibs/standard/src/javax/servlet/jsp/jstl/core/Config.java
Index: Config.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/javax/servlet/jsp/jstl/core/Config.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Config.java 11 Apr 2002 21:30:49 -0000 1.1
+++ Config.java 12 Apr 2002 02:11:02 -0000 1.2
@@ -168,12 +168,16 @@
switch (scope) {
case PageContext.PAGE_SCOPE:
pc.setAttribute(name + PAGE_SCOPE_SUFFIX, value, scope);
+ break;
case PageContext.REQUEST_SCOPE:
pc.setAttribute(name + REQUEST_SCOPE_SUFFIX, value, scope);
+ break;
case PageContext.SESSION_SCOPE:
pc.setAttribute(name + SESSION_SCOPE_SUFFIX, value, scope);
+ break;
case PageContext.APPLICATION_SCOPE:
pc.setAttribute(name + APPLICATION_SCOPE_SUFFIX, value, scope);
+ break;
default:
throw new IllegalArgumentException("unknown scope");
}
@@ -219,12 +223,16 @@
switch (scope) {
case PageContext.PAGE_SCOPE:
pc.removeAttribute(name + PAGE_SCOPE_SUFFIX, scope);
+ break;
case PageContext.REQUEST_SCOPE:
pc.removeAttribute(name + REQUEST_SCOPE_SUFFIX, scope);
+ break;
case PageContext.SESSION_SCOPE:
pc.removeAttribute(name + SESSION_SCOPE_SUFFIX, scope);
+ break;
case PageContext.APPLICATION_SCOPE:
pc.removeAttribute(name + APPLICATION_SCOPE_SUFFIX, scope);
+ break;
default:
throw new IllegalArgumentException("unknown scope");
}
1.3 +3 -1 jakarta-taglibs/standard/src/javax/servlet/jsp/jstl/fmt/LocaleSupport.java
Index: LocaleSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/javax/servlet/jsp/jstl/fmt/LocaleSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocaleSupport.java 20 Mar 2002 02:16:01 -0000 1.2
+++ LocaleSupport.java 12 Apr 2002 02:11:02 -0000 1.3
@@ -58,6 +58,7 @@
import java.util.*;
import java.text.*;
import javax.servlet.jsp.*;
+import javax.servlet.jsp.jstl.core.Config;
import org.apache.taglibs.standard.tag.common.fmt.BundleSupport;
import org.apache.taglibs.standard.tag.common.fmt.MessageSupport;
import org.apache.taglibs.standard.resources.Resources;
@@ -175,7 +176,8 @@
if (basename != null) {
bundle = BundleSupport.getBundle(pageContext, basename);
} else {
- bundle = BundleSupport.getDefaultBundle(pageContext);
+ bundle = (ResourceBundle) Config.find(pageContext,
+ Config.FMT_BUNDLE);
}
if (bundle != null) {
try {
1.18 +15 -74 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
Index: BundleSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- BundleSupport.java 11 Apr 2002 22:52:03 -0000 1.17
+++ BundleSupport.java 12 Apr 2002 02:11:02 -0000 1.18
@@ -65,29 +65,25 @@
import org.apache.taglibs.standard.resources.Resources;
/**
- * Support for tag handlers for <bundle>, the resource bundle
- * loading tag in JSTL 1.0.
+ * Support for tag handlers for <bundle>, the resource bundle loading
+ * tag in JSTL 1.0.
*
* @author Jan Luehe
*/
public abstract class BundleSupport extends BodyTagSupport {
-
+
//*********************************************************************
// Protected state
- protected String basename; // 'basename' attribute
- protected String prefix; // 'prefix' attribute
+ protected String basename; // 'basename' attribute
+ protected String prefix; // 'prefix' attribute
//*********************************************************************
// Private state
- private static ResourceBundle emptyResourceBundle;
-
- private String scope; // 'scope' attribute
- private String var; // 'var' attribute
private Locale fallbackLocale;
private ResourceBundle bundle;
@@ -95,38 +91,17 @@
//*********************************************************************
// Constructor and initialization
- static {
- emptyResourceBundle = new ListResourceBundle() {
- public Object[][] getContents() {
- return new Object[][] { { "", "" } };
- }
- };
- }
-
public BundleSupport() {
super();
init();
}
private void init() {
- basename = prefix = var = null;
+ basename = prefix = null;
bundle = null;
- scope = "page";
- }
-
-
- //*********************************************************************
- // Tag attributes known at translation time
-
- public void setVar(String var) {
- this.var = var;
}
- public void setScope(String scope) {
- this.scope = scope;
- }
-
//*********************************************************************
// Collaboration with subtags
@@ -143,33 +118,22 @@
// Tag logic
public int doStartTag() throws JspException {
+ if ((basename == null) || basename.equals("")) {
+ basename = (String) Config.find(pageContext, Config.FMT_BASENAME);
+ }
+
if ((basename != null) && !basename.equals("")) {
bundle = getBundle(pageContext, basename);
}
+
return EVAL_BODY_BUFFERED;
}
public int doEndTag() throws JspException {
- if (var != null) {
- if (bundle != null) {
- pageContext.setAttribute(var, bundle, Util.getScope(scope));
- } else {
- pageContext.setAttribute(var, emptyResourceBundle,
- Util.getScope(scope));
- }
- } else if (getBodyContent() == null) {
- /*
- * If no 'var' attribute and empty body, we store our base name
- * in the javax.servlet.jsp.jstl.fmt.basename scoped attribute
- */
- Config.set(pageContext, Config.FMT_BUNDLE, bundle,
- Util.getScope(scope));
- } else {
- try {
- pageContext.getOut().print(getBodyContent().getString());
- } catch (IOException ioe) {
- throw new JspTagException(ioe.getMessage());
- }
+ try {
+ pageContext.getOut().print(getBodyContent().getString());
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
}
return EVAL_PAGE;
@@ -237,29 +201,6 @@
LocaleSupport.setResponseLocale(pageContext, ret.getLocale());
}
- return ret;
- }
-
- /**
- * Gets the resource bundle with the default base name, which is given by
- * the scoped attribute or initialization parameter named
- * javax.servlet.jsp.jstl.fmt.exception.basename.
- *
- * @param pageContext the page in which the resource bundle is requested
- * @name the name of the scoped attribute or initialization parameter
- *
- * @return the requested resource bundle, or <tt>null</tt>
- * if the scoped attribute or initialization parameter with the given name
- * does not exist, or the requested resource bundle does not exist
- */
- public static ResourceBundle getDefaultBundle(PageContext pc) {
- ResourceBundle ret = null;
-
- String def = (String) Config.find(pc, Config.FMT_BASENAME);
- if (def != null) {
- ret = getBundle(pc, def);
- }
-
return ret;
}
1.17 +2 -1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java
Index: LocaleSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- LocaleSupport.java 11 Apr 2002 22:52:03 -0000 1.16
+++ LocaleSupport.java 12 Apr 2002 02:11:02 -0000 1.17
@@ -257,7 +257,8 @@
if (parent != null) {
// use locale from parent <fmt:bundle> tag
match = ((BundleSupport) parent).getBundle().getLocale();
- } else if ((bundle = BundleSupport.getDefaultBundle(pc)) != null) {
+ } else if ((bundle = (ResourceBundle)
+ Config.find(pc, Config.FMT_BUNDLE)) != null) {
// Use locale associated with default bundle base name.
match = bundle.getLocale();
} else {
1.13 +3 -2 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java
Index: MessageSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- MessageSupport.java 6 Apr 2002 21:17:15 -0000 1.12
+++ MessageSupport.java 12 Apr 2002 02:11:02 -0000 1.13
@@ -61,6 +61,7 @@
import javax.servlet.ServletContext;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.Config;
import org.apache.taglibs.standard.tag.common.core.Util;
import org.apache.taglibs.standard.resources.Resources;
@@ -170,7 +171,8 @@
bundle = parent.getBundle();
prefix = parent.getPrefix();
} else {
- bundle = BundleSupport.getDefaultBundle(pageContext);
+ bundle = (ResourceBundle) Config.find(pageContext,
+ Config.FMT_BUNDLE);
}
} else {
LocaleSupport.setResponseLocale(pageContext, bundle.getLocale());
@@ -178,7 +180,6 @@
String message = null;
if (bundle == null) {
- // error message already logged in BundleSupport.getBundle method
message = UNDEFINED_KEY + key + UNDEFINED_KEY;
} else {
try {
1.1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java
Index: SetBundleSupport.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.standard.tag.common.fmt;
import java.util.*;
import javax.servlet.ServletResponse;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.jstl.core.Config;
import org.apache.taglibs.standard.tag.common.core.Util;
import org.apache.taglibs.standard.resources.Resources;
/**
* Support for tag handlers for <setBundle>, the JSTL 1.0 tag that loads
* a resource bundle and stores it in a scoped variable.
*
* @author Jan Luehe
*/
public abstract class SetBundleSupport extends TagSupport {
//*********************************************************************
// Package-scoped constants
private static final ResourceBundle EMPTY_BUNDLE =
new ListResourceBundle() {
public Object[][] getContents() {
return new Object[][] { { "", "" } };
}
};
//*********************************************************************
// Protected state
protected String basename; // 'basename' attribute
//*********************************************************************
// Private state
private String scope; // 'scope' attribute
private String var; // 'var' attribute
//*********************************************************************
// Constructor and initialization
public SetBundleSupport() {
super();
init();
}
private void init() {
basename = null;
scope = "page";
}
//*********************************************************************
// Tag attributes known at translation time
public void setVar(String var) {
this.var = var;
}
public void setScope(String scope) {
this.scope = scope;
}
//*********************************************************************
// Tag logic
public int doEndTag() throws JspException {
ResourceBundle bundle = null;
if ((basename == null) || basename.equals("")) {
basename = (String) Config.find(pageContext, Config.FMT_BASENAME);
}
if ((basename != null) && !basename.equals("")) {
bundle = BundleSupport.getBundle(pageContext, basename);
}
if (bundle == null) {
// storing "null" in a scoped variable would cause a NPE
bundle = EMPTY_BUNDLE;
}
if (var != null) {
pageContext.setAttribute(var, bundle, Util.getScope(scope));
} else {
Config.set(pageContext, Config.FMT_BUNDLE, bundle,
Util.getScope(scope));
}
return EVAL_PAGE;
}
// Releases any resources we may have (or inherit)
public void release() {
init();
}
}
1.3 +5 -11 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java
Index: BundleTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BundleTag.java 9 Mar 2002 00:55:59 -0000 1.2
+++ BundleTag.java 12 Apr 2002 02:11:02 -0000 1.3
@@ -65,6 +65,7 @@
* <p>A handler for <bundle> that accepts attributes as Strings
* and evaluates them as expressions at runtime.</p>
*
+ * @author Shawn Bayern
* @author Jan Luehe
*/
@@ -136,17 +137,10 @@
// Evaluates expressions as necessary
private void evaluateExpressions() throws JspException {
- /*
- * Note: we don't check for type mismatches here; we assume
- * the expression evaluator will return the expected type
- * (by virtue of knowledge we give it about what that type is).
- * A ClassCastException here is truly unexpected, so we let it
- * propagate up.
- */
-
- // 'basename' attribute (mandatory)
- basename = (String) ExpressionEvaluatorManager.evaluate(
- "basename", basename_, String.class, this, pageContext);
+ if (basename_ != null) {
+ basename = (String) ExpressionEvaluatorManager.evaluate(
+ "basename", basename_, String.class, this, pageContext);
+ }
if (prefix_ != null) {
prefix = (String) ExpressionEvaluatorManager.evaluate(
1.1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/SetBundleTag.java
Index: SetBundleTag.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.standard.tag.el.fmt;
import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.apache.taglibs.standard.lang.support.*;
import org.apache.taglibs.standard.tag.common.fmt.*;
/**
* <p>A handler for <setBundle> that accepts attributes as Strings
* and evaluates them as expressions at runtime.</p>
*
* @author Shawn Bayern
* @author Jan Luehe
*/
public class SetBundleTag extends SetBundleSupport {
//*********************************************************************
// 'Private' state (implementation details)
private String basename_; // stores EL-based property
//*********************************************************************
// Constructor
/**
* Constructs a new SetBundleTag. As with TagSupport, subclasses
* should not provide other constructors and are expected to call
* the superclass constructor
*/
public SetBundleTag() {
super();
init();
}
//*********************************************************************
// Tag logic
// evaluates expression and chains to parent
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
// chain to the parent implementation
return super.doStartTag();
}
// Releases any resources we may have (or inherit)
public void release() {
super.release();
init();
}
//*********************************************************************
// Accessor methods
// for EL-based attribute
public void setBasename(String basename_) {
this.basename_ = basename_;
}
//*********************************************************************
// Private (utility) methods
// (re)initializes state (during release() or construction)
private void init() {
// null implies "no expression"
basename_ = null;
}
// Evaluates expressions as necessary
private void evaluateExpressions() throws JspException {
if (basename_ != null) {
basename = (String) ExpressionEvaluatorManager.evaluate(
"basename", basename_, String.class, this, pageContext);
}
}
}
1.1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java
Index: SetBundleTag.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.standard.tag.rt.fmt;
import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.apache.taglibs.standard.tag.common.fmt.*;
/**
* <p>A handler for <setBundle> that supports rtexprvalue-based
* attributes.</p>
*
* @author Jan Luehe
*/
public class SetBundleTag extends SetBundleSupport {
//*********************************************************************
// Accessor methods
// for tag attribute
public void setBasename(String basename) throws JspTagException {
this.basename = basename;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>