Search the documentation
 Show GitHub edit links  Hide GitHub edit links
Documented since: 9.5.2 Latest revision for: 9.5.2 Valid for OpenCms: 10.5.2

Here you get an overview on Java Beans you can use in JSPs. We show EL expressions, that provide you with an object of the beans.

The overview is not meant to be complete, but provides a good reference if you look for access a certain OpenCms specific information in your JSP.

Generally helpful beans

CmsJspStandardContextBean

Purpose

The CmsJspStandardContextBean is the default entry point for EL functionality. You get access to many more beans and to serveral information, such as page title, character encoding, locale, workplace locale, and much more contextual information.

EL expression

cms

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspStandardContextBean.html

CmsRequestContext

Purpose

Access to the OpenCms request context, e.g., to obtain user or project information.

EL expression

cms.requestContext

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/file/CmsRequestContext.html

CmsJspVfsAccessBean

Purpose

Get access to arbitrary resources in the VFS, check existence or permissions, get links, read properties, get the resource object or directly extract XML contents.

EL expression

cms.vfs

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspVfsAccessBean.html

CmsUser

Purpose

Get information on the (current) user - like name, email etc. - or simply check if someone is logged in.

EL expression

cms.requestContext.currentUser

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/gwt/CmsUrlNameValidationService.html

CmsProject

Purpose

Get information on the (current) project, e.g., name, description, type, etc.

EL expression

cms.requestContext.currentProject

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/file/CmsProject.html

CmsResource

Purpose

Explore resource meta information (state, creation date, file or folder, expiration date, ...).

EL expression

Some resource cms.vfs.resource[<site relative path>]

Currently requested resource: cms.vfs.resource[cms.requestContext.uri]

Availability

All OpenCms managed JSPs. The resource must exist and the current user needs appropriate access rights to get access on the resource.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/file/CmsResource.html

http://documentation.opencms.org/javadoc/core/org/opencms/file/I_CmsResource.html

CmsSystemInfo

Purpose

Get information on your OpenCms installation.

EL expression

cms.systemInfo

Availability

All OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/main/CmsSystemInfo.html

Containerpage and element exploration

CmsContainerPageBean

Purpose

Explore a container page, get information on the present containers and the contained elements.

EL expression

Currently rendered container page: cms.page

Currently rendered detail only page: cms.detailOnlyPage

Availability

Formatters and function providers, template JSPs

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/xml/containerpage/CmsContainerPageBean.html

CmsContainerBean

Purpose

Get information on the container you are in, e.g., container parameter, type, name etc.

EL expression

cms.container

Availability

Formatters and function providers

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/xml/containerpage/CmsContainerBean.html

CmsJspStandardContextBean.CmsContainerElementWrapper

Purpose

Get information for the currently rendered container page element, e.g., element settings.

EL expression

cms.element

Availability

Formatters and function providers

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspStandardContextBean.CmsContainerElementWrapper.html

CmsJspStandardContextBean.ElementSettingWrapper

Purpose

Check the existence of an element setting, check if its set and get its value - optionally as Double, Float, ....

EL expression

cms.element.setting["<setting's name>"]

Availability

Formatters and function providers

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspStandardContextBean.ElementSettingWrapper.html

Content access

CmsJspContentAccessBean

Purpose

Easy access to XML contents.

EL expression

As content variable in a formatter:

  • <cms:formatter var="content"> ... </cms:formatter>

As content variable in a contentload/contentaccess combination for creating a list:

  • <cms:contentload ...> ... <cms:contentaccess var="content" /> ... </cms:contentload>
Availability

Via <cms:formatter> in formatters, via <cms:contentaccess> additionally in all other OpenCms managed JSPs.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspContentAccessBean.html

CmsJspContentAccessValueWrapper

Purpose

Easy navigation to, check of and access to values in XML contents.

EL expression

With content of type CmsJspContentAccessBean:

  • content.value.<XML node name> or

or already of type CmsJspContentAccessValueWrapper:

  • content.value["<XPath>"]
Availability

Formatters and if lists are build.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.html

CmsContentLoadBean

Purpose

Explore the result of a <cms:contentload>, usually to get the number of loaded items.

EL expression

Via info in: <cms:contentload var="info" ...> ... </cms:contentload>

Availability

Via <cms:contentload>, typically in formatters or function providers.

JavaDoc

http://documentation.opencms.org/javadoc/core/org/opencms/jsp/util/CmsJspContentLoadBean.html

You can improve this page

Please contribute your suggestions or comments regarding this topic on our wiki. For support questions, please use the OpenCms mailing list or go for professional support.