Get the CmsObject

(Difference between revisions)
Jump to: navigation, search
(Added how to get it with EL)
m (Changed lang ("java" is very ugly for jsps))
Line 15: Line 15:
  
 
===Getting the CmsObject using EL===
 
===Getting the CmsObject using EL===
<source lang="java">
+
<source lang="html4strict">
 
   <%@taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
 
   <%@taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
  

Revision as of 11:25, 24 August 2012

The CmsObject gives you access to many of OpenCMS' features.

Getting the CmsObject in scriptlets

   <%@page import="org.opencms.file.CmsObject"%>
   <%@page import="org.opencms.jsp.CmsJspActionElement"%>
   <%
      CmsJspActionElement jsp = new CmsJspActionElement(pageContext, request, response);
      CmsObject cms = jsp.getCmsObject();
 
      ... do something useful
   %>

Getting the CmsObject using EL

   <%@taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
 
   <c:set var="co" value="${cms:getCmsObject(pageContext)}" />
   <%-- ... do something useful --%>
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox