OpenCms JSP standard taglib
Tag contentload


This tag loads XML content items from the OpenCms VFS. It is in particular useful to iterate over a list of collected content. For each content the code in the body is executed once.

Use <cms:contentaccess> to access loaded contents.


Tag Information
Tag Classorg.opencms.jsp.CmsJspTagContentLoad
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
collectorfalsetruejava.lang.StringThe collector used to collect resources. OpenCms provides several predefined collectors via the classes located in the package org.opencms.file.collectors.

Maybe the most important collectors are provided by the class CmsSolrCollector:

byQuery
Executes exactly the query provided via the attribute param
byContext
Executes the query provided via the attribute param, but additionally taking the request context into account.
Other standard collectors are:
allInFolder
Returns all resources of the requested type in a folder. Folder and type are specified via the attribute param
allInSubTree
Returns all resources of the requested type in a sub-tree. The root folder of the sub tree and the type or resources are specified via the attribute param
These two standard collectors can also sort the collected entries in different forms. Therefore, append the way of sorting to the collector's names. Sorting can be specified by the following collector names, where "xxx" has to be replaced either by "allInFolder" or "allInSubTree":
xxxNavPos
Sort the resources ascending via the NavPos property.
xxxDateReleasedDesc
Sort the resources descending via their DateReleased attribute.
xxxPriorityTitleDesc
Sort the resources descending via their collector.priority property. Resources with the same priority are sorted lexicographically ascending via the Title property.
xxxPriorityDateAsc
Sort the resources descending via their collector.priority property. Resources with the same priority are sorted ascending via the collector.date property.
xxxPriorityDateDesc
Sort the resources descending via their collector.priority property. Resources with the same priority are sorted descending via the collector.date property.
There are many more collectors already shipped with OpenCms. For Documentation, lookup either the JavaDoc or the source code of the classes in the package org.opencms.file.collectors.

To implement your own collector, extend the abstract class A_CmsResourceCollector and configure your collector in the opencms-vfs.xml.
paramfalsetruejava.lang.StringConfigures the collector set via the attribute collector.
The allowed values depend on the chosen collectors. Consult the documentation for more information.
propertyfalsetruejava.lang.StringDeprecated. Not evaluated anymore.
editablefalsetruejava.lang.StringChoose if direct edit is supported. The following values are allowed:
false (default)
Direct edit is disabled.
true
Direct edit is enabled. If at least one content is collected, contents can be added, edited and deleted via direct edit.
editEmptyfalsetruejava.lang.StringChoose if an element can be added if no content is collected. The attribute is independent of the attribute editable. The following values are allowed:
false (default)
Disables adding a new content via direct edit, if none is found.
true
Enables adding a new content via direct edit, if none is found.
pageIndexfalsetruejava.lang.StringA page number (starting at 1). If set, <cms:contentload> iterates only over the contents of the given page.

Note: The attribute has to be used in combination with pageSize.
pageSizefalsetruejava.lang.StringSpecifies the number of results shown per page.

Note:The attribute has to be used in combination with pageIndex.
pageNavLengthfalsetruejava.lang.StringSpecifies the number of pages shown in the page navigation. It influences the values the properties pageNavLength, pageNavStartIndex and pageNavEndIndex of the org.opencms.jsp.CmsContentInfoBean object made available via <cms:contentinfo>
preloadfalsetruejava.lang.StringPreload content to make information on the content available. A preload is more efficient then a complete load. A typical use case is:
 <cms:contentload collector="allInFolder" param="/demo/.content/textblocks/tb_%(number).xml|bs-textblock" preload="true">
  <cms:contentinfo var="info" />
  Number of results: ${info.resultSize}
  <c:if test="${info.resultSize > 0}">
    <cms:contentload>
      <cms:contentinfo var="info" />
      <cms:contentaccess var="content" />
      The title of the content: ${content.value.Title} (${info.resultIndex}/${info.resultSize})<br />
    </cms:contentload>
  </c:if>
</cms:contentload>
localefalsetruejava.lang.StringUse in combination with the attribute var to define the locale in which content is accessed.

Default: The locale defined in the request context.
varfalsetruejava.lang.StringName of the exported variable that provides access to all XML contents loaded via <cms:contentload>.

The exported variable has type org.opencms.jsp.util.CmsJspContentLoadBean.
scopefalsetruejava.lang.StringThe scope, where the variable exposed via var is placed.
The following values are supported:
page (default)
Place the objects that are exported via variables in the page scope.
request
Place the objects that are exported via variables in the request scope.
session
Place the objects that are exported via variables in the session scope.
application
Place the objects that are exported via variables in the application scope.
postCreateHandlerfalsetruejava.lang.StringNo Description

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.