Description
The CmsJspTemplateHelper is a CmsJspActionElement and can be used in JSP Pages inside of OpenCms.
OpenCms is a Content Management System that is based on Open Source Software. Complex Intranet and Internet websites can be quickly and cost-effectively created, maintained and managed.
Config
This CmsJspActionElement must be configured in the header of the JSP-Page.
The entry could look like the following:
<%@ page import="at.infonova.opencms.modules.templatehelper.CmsJspTemplateHelper"%>
<%
CmsJspTemplateHelper cms = new CmsJspTemplateHelper(pageContext, request, response);
request.setAttribute("cms", cms);
%>
Example Usage
The default prefix of this CmsJspActionElement should be 'cms'.
After that, the following Methods are available in JSP:
- ${cms.help} => This helptext.
- ${cms.link[java.lang.String]} => The same as <cms:link ... /> from OpenCms Taglib.
- ${cms.content} => The Xml Content of the current Resource (request uri) as POJO. The same as ${cms.fileContent[cms.requestContext.uri]}.
- ${cms.template} => Return the Xml Content of the XML-Template as POJO. Nearly the same as ${cms.fileContent[cms.property.template]}.
- ${cms.fileContent[java.lang.String]} => The Xml Content of the given Resource as POJO. The file must be a structured Content (xmlContent) or a XmlPage.
- ${cms.property} => Properties of the current Resource (request uri) as Map. The same as ${cms.fileProperty[cms.requestContext.uri]}. Example: ${cms.property.template.value} returns the value of CmsProperty 'template' of the current resource.
- ${cms.fileProperty[java.lang.String]} => Properties of the given Resource as Map. Example: ${cms.fileProperty[cms.requestContext.uri]}.template.value} returns the value of CmsProperty 'template' of the current resource.
- ${cms.requestContext} => Returns the current users request context.
- ${cms.fileResourceType[java.lang.String]} => Returns the I_CmsResourceType of the given Resource. Example: ${cms.fileResourceType[cms.property.template].typeName}.
- ${cms.resourceType} => Returns the I_CmsResourceType of the current Resource (request uri). Example: ${cms.resourceType.typeName}. The same as: ${cms.fileResourceType[cms.requestContext.uri].typeName}.
- ${cms.fileResource[java.lang.String]} => Returns the CmsResource of the given Resource. Example: ${cms.fileResource[cms.property.template].resourceId}.
- ${cms.resource} => Returns the CmsResource of the current Resource (request uri). Example: ${cms.resource.resourceId}. The same as: ${cms.fileResource[cms.requestContext.uri].resourceId}.
- ${cms.filePathLevel[java.lang.String]} => Returns the directory level of the given Resource path. Example: ${cms.filePathLevel['/foo/index.html']}.
- ${cms.pathLevel} => Returns the directory level of the current Resource (request uri). Example: ${cms.pathLevel}. The same as: ${cms.filePathLevel[cms.requestContext.uri]}.
- ${cms.randomUUID} => Returns a new random UUID. This is useful for HTML-TAG-Ids and accessing it from javascript.
- ${cms.encoding} => Returns the 'content encoding' property value of the requested uri.
- ${cms.childFolderPaths[java.lang.String]} => Returns the list of the child folders for the given resourcePath.
- ${cms.navigationBreadcrumb[int]} => Returns the Breadcrumb as List of CmsJspNavElement for the given startLevel.
- ${cms.navigationForFolder[java.lang.String]} => Returns the List of CmsJspNavElement in the given folder.
- ${cms.navigationSiteMap[java.lang.String]} => Returns the complete navigation site tree as List of CmsJspNavElement starting from the given path.
- ${cms.navigationLevel[int]} => Returns the List of CmsJspNavElement for the given level in the current request uri.