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:
Serializable,IterationTag,JspTag,Tag
SetContentBundleTag implements a custom tag, which sets a
LocalizationContext backed with a ContentResourceBundle. 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:
-
Field Summary
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoEndTag()Sets a defaultLocalizationContextinConfigwith a page scope.voidsetBasename(String basename) voidsetLanguage(String language) voidMethods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
-
Constructor Details
-
SetContentBundleTag
public SetContentBundleTag()
-
-
Method Details
-
doEndTag
public int doEndTag()Sets a defaultLocalizationContextinConfigwith a page scope.- Specified by:
doEndTagin interfaceTag- Overrides:
doEndTagin classTagSupport- Returns:
Tag.EVAL_PAGE.- See Also:
-
setSource
- Throws:
JspException
-
getSource
-
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
- Parameters:
language- the language that will be used when a resource bundle is obtained.
-
getBasename
- Returns:
- the currently set basename that should be used or
null.
-
setBasename
- Parameters:
basename- the basename that will be used when a resource bundle is obtained.
-