Package com.day.cq.wcm.tags
Class SetContentBundleTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- com.day.cq.wcm.tags.SetContentBundleTag
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag
public class SetContentBundleTag extends javax.servlet.jsp.tagext.TagSupportSetContentBundleTagimplements a custom tag, which sets aLocalizationContextbacked with aContentResourceBundle. This allows one to use property names as keys in a JSTL formatting action and use the value of the property as localized message.The provided resource bundle also uses the resource bundle provided by CQ as a fallback if the underlying Resource does not contain a certain key.
The language/locale of the CQ resource bundle is determined depending on the "source" attribute, which can be either
- static use "language" attribute,
- request uses request.getLocale(),
- page uses language of the current page or resource or
- auto page if available, otherwise use locale from request.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SetContentBundleTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdoEndTag()Sets a defaultLocalizationContextinConfigwith a page scope.java.lang.StringgetBasename()java.lang.StringgetLanguage()java.lang.StringgetSource()voidsetBasename(java.lang.String basename)voidsetLanguage(java.lang.String language)voidsetSource(java.lang.String source)
-
-
-
Method Detail
-
doEndTag
public int doEndTag()
Sets a defaultLocalizationContextinConfigwith a page scope.- Specified by:
doEndTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjavax.servlet.jsp.tagext.TagSupport- Returns:
Tag.EVAL_PAGE.
-
setSource
public void setSource(java.lang.String source) throws javax.servlet.jsp.JspException- Throws:
javax.servlet.jsp.JspException
-
getSource
public java.lang.String getSource()
-
getLanguage
public java.lang.String getLanguage()
- Returns:
- the currently set language that should be used or
nullif the language should be derived from the path of the current resource.
-
setLanguage
public void setLanguage(java.lang.String language)
- Parameters:
language- the language that will be used when a resource bundle is obtained.
-
getBasename
public java.lang.String getBasename()
- Returns:
- the currently set basename that should be used or
null.
-
setBasename
public void setBasename(java.lang.String basename)
- Parameters:
basename- the basename that will be used when a resource bundle is obtained.
-
-