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

public class CmsJspTagProperty extends javax.servlet.jsp.tagext.TagSupport
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:
  • Constructor Details

  • Method Details

    • propertiesTagAction

      public static Map<String,String> propertiesTagAction(String action, javax.servlet.ServletRequest req) throws CmsException
      Internal action method.

      Parameters:
      action - the search action
      req - 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 up
      action - the search action
      defaultValue - the default value
      escape - if the result html should be escaped or not
      req - 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 up
      action - the search action
      defaultValue - the default value
      escape - if the result html should be escaped or not
      req - the current request
      locale - 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

      public int doEndTag()
      Specified by:
      doEndTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class javax.servlet.jsp.tagext.TagSupport
      See Also:
      • TagSupport.doEndTag()
    • doStartTag

      public int doStartTag() throws javax.servlet.jsp.JspException
      Specified by:
      doStartTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doStartTag in class javax.servlet.jsp.tagext.TagSupport
      Returns:
      SKIP_BODY
      Throws:
      javax.servlet.jsp.JspException
      See Also:
      • Tag.doStartTag()
    • getDefault

      public String 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

      public String getFile()
      Returns the file name.

      Returns:
      the file name
    • getName

      public String getName()
      Returns the property name.

      Returns:
      String the property name
    • release

      public void release()
      Specified by:
      release in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      release in class javax.servlet.jsp.tagext.TagSupport
      See Also:
      • Tag.release()
    • setDefault

      public void setDefault(String def)
      Sets the default value.

      This is used if a selected property is not found.

      Parameters:
      def - the default value
    • setEscapeHtml

      public void setEscapeHtml(String value)
      Set the escape html flag.

      Parameters:
      value - should be "true" or "false" (all values other then "true" are considered to be false)
    • setFile

      public void setFile(String file)
      Sets the file name.

      Parameters:
      file - the file name
    • setLocale

      public void setLocale(String locale)
      Sets the locale for which the property should be read.
      Parameters:
      locale - the locale for which the property should be read.
    • setName

      public void setName(String name)
      Sets the property name.

      Parameters:
      name - the property name to set