# <cm:getProperty> Tag

The <cm:getProperty> tag retrieves a property value from a content node. Properties are contained in "types" in the BEA Virtual Content Repository. You can store the property value in a variable or print it. Use this tag for text-only property values or text-based binary files (such as HTML, XML, or TXT). Do not use this tag to retrieve non-text binaries, such as graphics.

If a property format is binary, but the file stored in that property is a text file, the entire text file is considered to be the property value.

## Syntax

<tagName attribute="value" />

## Attributes

node

Optional (Node) - The content node from which to retrieve the property. If this attribute is left blank or if the node is not found using this value, the id value is used.

name

Optional (String) - The name of the property to retrieve. If you select a system property (createdBy, createDate, modifiedBy, modifiedDate, and path), the value of that node's property is retrieved. If you leave this attribute empty, the content node's primary property is used, if defined.

id

Optional (String) - The pageContext attribute name to use for the node.

resultId

Optional (String) - The variable in which the property value is stored. Use with the id attribute. If this attribute is not used, the value of the property is printed in the JSP instead of stored as a variable. Many of the following properties can be used to format the property value printed in the JSP when this attribute is not set.

isMultiple

Optional (boolean) - If the property contains multiple values, set to "true." The resultId variable is treated as a Collection. If the property has a single value, set to "false." The resultId is treated as an Object that can be cast to the Java type specified in the resultType attribute. The default is "true."

resultType

Optional (String) - The Java type to which the single property value is cast. You cannot use this property if the isMultiple attribute is set to "true," the default.

default

Optional (String) - If the resultId is not set, this specifies the text to print if the property does not exist for the content object.

conversionType

Optional (String) - If the resultId is not set, this setting ("html," "url," or "none") tells the JSP how to render the property value. The "html" setting converts HTML special characters to their entity form. The "url" setting converts text using java.net.URLEncoder. The "none" setting performs no conversion or encoding. The default is "none."

dateFormat

Optional (String) - If the resultId is not set and the property is a java.util.Date value, this determines a date format. Use java.util.SimpleDateFormat notation.

numFormat

Optional (String) - If the resultId is not set and the property is a number, this determins the number format. Use java.util.NumFormat notation.

blockSize

Optional (int) - Sets the size of the blocks in bytes in which the property value is read. It is used to read in text binary property values (such as HTML files) to determine the chunk size that is read from the InputStream and written to the PageContext output writer.

startIndex

Optional (int) - The index (from 0) in bytes to start printing the content.

endIndex

Optional (int) - The index (from 0) in bytes to stop printing the content.

baseHref

Optional (String) - Use this attribute only if the property value (usually a text-based binary file) contains relative links to other documents stored in the BEA Virtual Content Repository. This attribute resolves references to repository-based content by setting the base reference to the ShowBinaryServlet. The value should usually be <%=request.getContextPath() + "/ShowBinary"%>.

failOnError

Optional (boolean) - This attribute can have one of two values:

- false (default value): Handles JSP processing errors gracefully and prints nothing if an error occurs. Returns null on an error.
- true: Throws an exception. You can handle the exception in the code, let the page proceed to the normal error page, or let the application server handle it less gracefully.

transactionTimeout

Optional (int) - The time, in seconds, before a transaction will time out. Set this attribute if you need a transaction timeout longer than WebLogic default settings. The default value for this attribute is -1, which indicates that the transaction timeout will use the WebLogic default settings.

## Example

    <p>
    	<cm:getProperty node="<%=images %>" name="demographic" default="No content node found." />
    </p>

Related Topics

<cm:getNode> Tag

<cm:search> Tag