org.opencms.jsp
Class CmsJspTagProperty

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byorg.opencms.jsp.CmsJspTagProperty
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, 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.
{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
Version:
$Revision: 1.21 $
Author:
Alexander Kandzior
See Also:
Serialized Form

Field Summary
static java.lang.String[] ACTION_VALUES
          Static array of the possible "file" properties.
static java.util.List ACTION_VALUES_LIST
          Array list for fast lookup.
static java.lang.String USE_ELEMENT_URI
          Accessor constant: Use element uri.
static java.lang.String USE_PARENT
          Accessor constant: Use parent (same as USE_URI).
static java.lang.String USE_SEARCH
          Accessor constant: Use search (same as USE_SEARCH_URI).
static java.lang.String USE_SEARCH_ELEMENT_URI
          Accessor constant: Use search element uri.
static java.lang.String USE_SEARCH_PARENT
          Accessor constant: Search parent (same as USE_SEARCH_URI).
static java.lang.String USE_SEARCH_THIS
          Accessor constant: Use seach this (same as USE_SEARCH_ELEMENT_URI).
static java.lang.String USE_SEARCH_URI
          Accessor constant: Search uri.
static java.lang.String USE_THIS
          Accessor constant: Use this (same as USE_ELEMENT_URI).
static java.lang.String USE_URI
          Accessor constant: Use uri.
 
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
CmsJspTagProperty()
           
 
Method Summary
 int doStartTag()
           
 java.lang.String getDefault()
          Returns the default value.
 java.lang.String getEscapeHtml()
          The value of the escape html flag.
 java.lang.String getFile()
          Returns the file name.
 java.lang.String getName()
          Returns the property name.
static java.lang.String propertyTagAction(java.lang.String property, java.lang.String action, java.lang.String defaultValue, boolean escape, javax.servlet.ServletRequest req)
          Internal action method.
 void release()
           
 void setDefault(java.lang.String def)
          Sets the default value.
 void setEscapeHtml(java.lang.String value)
          Set the escape html flag.
 void setFile(java.lang.String file)
          Sets the file name.
 void setName(java.lang.String name)
          Sets the property name.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_ELEMENT_URI

public static final java.lang.String USE_ELEMENT_URI
Accessor constant: Use element uri.

See Also:
Constant Field Values

USE_PARENT

public static final java.lang.String USE_PARENT
Accessor constant: Use parent (same as USE_URI).

See Also:
Constant Field Values

USE_SEARCH

public static final java.lang.String USE_SEARCH
Accessor constant: Use search (same as USE_SEARCH_URI).

See Also:
Constant Field Values

USE_SEARCH_ELEMENT_URI

public static final java.lang.String USE_SEARCH_ELEMENT_URI
Accessor constant: Use search element uri.

See Also:
Constant Field Values

USE_SEARCH_PARENT

public static final java.lang.String USE_SEARCH_PARENT
Accessor constant: Search parent (same as USE_SEARCH_URI).

See Also:
Constant Field Values

USE_SEARCH_THIS

public static final java.lang.String USE_SEARCH_THIS
Accessor constant: Use seach this (same as USE_SEARCH_ELEMENT_URI).

See Also:
Constant Field Values

USE_SEARCH_URI

public static final java.lang.String USE_SEARCH_URI
Accessor constant: Search uri.

See Also:
Constant Field Values

USE_THIS

public static final java.lang.String USE_THIS
Accessor constant: Use this (same as USE_ELEMENT_URI).

See Also:
Constant Field Values

USE_URI

public static final java.lang.String USE_URI
Accessor constant: Use uri.

See Also:
Constant Field Values

ACTION_VALUES

public static final java.lang.String[] ACTION_VALUES
Static array of the possible "file" properties.


ACTION_VALUES_LIST

public static final java.util.List ACTION_VALUES_LIST
Array list for fast lookup.

Constructor Detail

CmsJspTagProperty

public CmsJspTagProperty()
Method Detail

propertyTagAction

public static java.lang.String propertyTagAction(java.lang.String property,
                                                 java.lang.String action,
                                                 java.lang.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:
String the value of the property or null if not found (and no defaultValue provided)
Throws:
CmsException - if something goes wrong

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Returns:
SKIP_BODY
Throws:
javax.servlet.jsp.JspException - in case somethins goes wrong
See Also:
Tag.doStartTag()

getDefault

public java.lang.String getDefault()
Returns the default value.

Returns:
the default value

getEscapeHtml

public java.lang.String getEscapeHtml()
The value of the escape html flag.

Returns:
the value of the escape html flag

getFile

public java.lang.String getFile()
Returns the file name.

Returns:
the file name

getName

public java.lang.String getName()
Returns the property name.

Returns:
String the property name

release

public void release()
See Also:
Tag.release()

setDefault

public void setDefault(java.lang.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(java.lang.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(java.lang.String file)
Sets the file name.

Parameters:
file - the file name

setName

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

Parameters:
name - the property name to set