EL functions provided by OpenCMS taglib
The OpenCMS taglib provides tags, but also functions. You can see their definition in the WEB-INF/opencms.tld file, the functions themselves are provided by the CmsJspElFunctions class.
Just declare the taglib as usual:
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
Contents |
cms:vfs
Provides access to VFS (Virtual File System), returns an instance of org.opencms.jsp.util.CmsJspVfsAccessBean. Example:
${cms:vfs(pageContext).context.locale}
cms:convertDate
Allows conversion of Long values to Dates. For example to display the time of last modification of a page:
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %> <%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %> ... <f:formatDate value="${cms:convertDate(cms:vfs(pageContext).resource[cms:vfs(pageContext).context.uri].dateLastModified)}" pattern="yyyy-MM-dd HH:mm:ss" />
cms:getCmsObject
Returns the current OpenCms user context form the page context.
cms:convertLocale
Allows conversion of Objects to Locales. Can also handle Strings that are locales, or Locales itself. If no valid locale is provided, the OpenCms default locale is returned.
cms:stripHtml
Strips all HTML markup from the given input.
cms:trimToSize
Returns a substring of the input, which is not longer then the given int value.
${cms:trimToSize('aaabbb',3)}
cms:convertUUID
Allows conversion of String values to CmsUUIDs. Can also handle byte[] that are CmsUUIDs, or CmsUUID itself.
cms:getRequestParam
Returns the value of a parameter from a String that is formatted for a GET request.
cms:getRequestLink
Returns the link without parameters from a String that is formatted for a GET request.
cms:escape
Encodes a String in a way that is compatible with the JavaScript escape function.
cms:unescape
Decodes a String in a way that is compatible with the JavaScript unescape function.