A note from 2026: This article was published in 2016, when the JSP-based Accelerator storefront was the standard SAP hybris storefront. SAP hybris has since been renamed SAP Commerce Cloud, and many projects now use SAP Composable Storefront; these JSP variables are mainly relevant to legacy Accelerator-based storefronts.

Introduction

JSP capabilities are poorly documented in the hybris Wiki. It is expected that frontend and backend developers work closely together, and frontend developers commonly expect that all necessary data is provided by page and component controllers. However, some data is already available in JSP, and frontend developers can leverage it. Most of the variables listed below are hybris-specific and not officially documented. However, you can find some usage examples in hybris OOTB templates.

I decided to put all this stuff in one place to use it as a reference for the future.

See the last section of this article for technical details.

Reference

What variables come from the controller?

To answer this question, you need to iterate through a pageRequest object:

<c:set var='scope' value='${requestScope}'/>
<c:forEach items='${scope}' var='p'>
         <ul>
            <%-- Display the key of the current item, which
                 represents the model attribute name --%>
            <li>Model Attribute Name: <c:out value='${p.key}'/></li>

            <%-- Display the value of the current item, which
                 represents the model attribute value --%>
            <li>Model Attribute Value: <c:out value='${p.value}'/></li>
         </ul>
</c:forEach>

In total, there are four scopes, and you can see the variables from any of them using the code above (change the value of the c:set tag):

The value of the model attribute is a string representation of the object. If the object is not capable of converting itself to a String, you need to request one of the getters manually. For example:

Example JSP output showing CMS page request context data

How can you understand what attributes are available for the object? The simplest way is to put something that definitely leads to an error, try to reload the page, and look at the logs for the class name. Then open the class with this name and look through the getter methods.

Let’s try to put the following code into the template (I replaced “uid” with “something”):

${cmsPageRequestContextData.page.something}

Log output showing that the property something is not found on the type

This piece of the log shows that the property “something” is not found on the type. All we need is the class name, de.hybris.platform.cms2.model.pages.ContentPageModel. This class and its predecessors have the following getter methods:

ContentPageModel extends AbstractPageModel:

public List<BannerComponentModel> getBannerComponents()
public String getDescription()
public List<FlashComponentModel> getFlashComponents()
public String getKeywords()
public String getLabel()
public String getLabelOrId()
public List<CMSLinkComponentModel> getLinkComponents()
public List<CMSNavigationNodeModel> getNavigationNodes()

AbstractPageModel extends CMSItemModel

public CmsApprovalStatus getApprovalStatus()
public String getAvailableContentSlots()
public List<ContentSlotForPageModel> getContentSlots()
public Boolean getDefaultPage()
public UserModel getLockedBy()
public PageTemplateModel getMasterTemplate()
public String getMissingContentSlots()
public List<CMSNavigationNodeModel> getNavigationNodeList()
public MediaModel getPreviewImage()
public List<AbstractRestrictionModel> getRestrictions()
public String getTitle()
public String getType()
public String getTypeCode()
public String getView()

CMSItemModel extends ItemModel:

So as you can see, the following syntax is possible for this object in JSP templates:

Every ${XXX} in JSP will be compiled to the following Java code:

out.write(
  (java.lang.String)
     org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
       "${XXX}", // expression
        java.lang.String.class, // expectedType
        (javax.servlet.jsp.PageContext) this.getJspContext(),
        null, //functionMap
        false //escape
     )
);

© Rauf Aliev, September 2016