Package org.opencms.jsp
Class CmsJspTagProperty
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.opencms.jsp.CmsJspTagProperty
- All Implemented Interfaces:
Serializable
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
Provides access to the properties of a resource in the OpenCms VFS .
Of particular importance is the setting of the file
attribute,
which can take the following values.
This attribute allows you to specify where to search for the property.
The following values are supported:
- uri (default)
- Look up the property on the file with the uri requested by the user.
- search.uri or search
- Look up the property by also checking all parent folders for the property, starting with the file with uri requested by the user and going "upward" if the property was not found there.
- element.uri
- Look up the property on the currently processed sub - element. This is useful in templates or other pages that consist of many elements.
- search.element.uri
- Look up the property by also checking all parent folders for the property, starting with the file with the currently processed sub - element and going "upward" if the property was not found there.
- sitemap
- reads from the current sitemap entry
- search.sitemap
- Look up the property by also checking all parent sitemap entries for the property, starting with the current sitemap entry and going "upward" if the property was not found there.
- container
- reads from the current container element
- {some-file-uri}
- Look up the property on that exact file uri in the OpenCms VFS, fallback if no other valid option is selected for the file attribute.
There are also some deprecated options for the "file" value that are still supported but should not longer be used:
- parent
- same as uri
- search-parent
- same as search.uri
- this
- same as element.uri
- search-this
- same as search.element.uri
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Tells for which resource properties should be looked up (with or without searching), depending on theCmsJspTagProperty.FileUse
. -
Field Summary
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
doEndTag()
int
Returns the default value.The value of the escape html flag.getFile()
Returns the file name.getName()
Returns the property name.propertiesTagAction
(String action, javax.servlet.ServletRequest req) Internal action method.static String
propertyTagAction
(String property, String action, String defaultValue, boolean escape, javax.servlet.ServletRequest req) Internal action method.static String
propertyTagAction
(String property, String action, String defaultValue, boolean escape, javax.servlet.ServletRequest req, Locale locale) Internal action method.void
release()
void
setDefault
(String def) Sets the default value.void
setEscapeHtml
(String value) Set the escape html flag.void
Sets the file name.void
Sets the locale for which the property should be read.void
Sets the property name.Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
Constructor Details
-
CmsJspTagProperty
public CmsJspTagProperty()
-
-
Method Details
-
propertiesTagAction
public static Map<String,String> propertiesTagAction(String action, javax.servlet.ServletRequest req) throws CmsException Internal action method.- Parameters:
action
- the search actionreq
- the current request- Returns:
- String the value of the property or
null
if not found (and no defaultValue provided) - Throws:
CmsException
- if something goes wrong
-
propertyTagAction
public static String propertyTagAction(String property, String action, String defaultValue, boolean escape, javax.servlet.ServletRequest req) throws CmsException Internal action method.- Parameters:
property
- the property to look upaction
- the search actiondefaultValue
- the default valueescape
- if the result html should be escaped or notreq
- the current request- Returns:
- the value of the property or
null
if not found (and no defaultValue was provided) - Throws:
CmsException
- if something goes wrong
-
propertyTagAction
public static String propertyTagAction(String property, String action, String defaultValue, boolean escape, javax.servlet.ServletRequest req, Locale locale) throws CmsException Internal action method.- Parameters:
property
- the property to look upaction
- the search actiondefaultValue
- the default valueescape
- if the result html should be escaped or notreq
- the current requestlocale
- the locale for which the property should be read- Returns:
- the value of the property or
null
if not found (and no defaultValue was provided) - Throws:
CmsException
- if something goes wrong
-
doEndTag
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.TagSupport
- See Also:
-
TagSupport.doEndTag()
-
doStartTag
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.TagSupport
- Returns:
- SKIP_BODY
- Throws:
javax.servlet.jsp.JspException
- See Also:
-
Tag.doStartTag()
-
getDefault
Returns the default value.- Returns:
- the default value
-
getEscapeHtml
The value of the escape html flag.- Returns:
- the value of the escape html flag
-
getFile
Returns the file name.- Returns:
- the file name
-
getName
Returns the property name.- Returns:
- String the property name
-
release
- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classjavax.servlet.jsp.tagext.TagSupport
- See Also:
-
Tag.release()
-
setDefault
Sets the default value.This is used if a selected property is not found.
- Parameters:
def
- the default value
-
setEscapeHtml
Set the escape html flag.- Parameters:
value
- should be"true"
or"false"
(all values other then"true"
are considered to be false)
-
setFile
Sets the file name.- Parameters:
file
- the file name
-
setLocale
Sets the locale for which the property should be read.- Parameters:
locale
- the locale for which the property should be read.
-
setName
Sets the property name.- Parameters:
name
- the property name to set
-