6

The page template metadata for DXA 2.0 has a field named "htmlClasses". We have been attempting to use this in our java web app but, so far, every attempt has resulted in this field appearing as null.

The code for our page view is similar to the example provided in https://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v4/GUID-978BB162-D5F6-41C2-B73C-8DB4124E8A4B in that we have been using the default page model and trying to load the classes field with

<jsp:useBean id="pageModel" type="com.sdl.webapp.common.api.model.PageModel" scope="request"/>
<body>
    <div class="page-row page-row-expanded ${pageModel.htmlClasses}" >
</body>

I've included the fields that are filled in in the page that we are working with.

Sample page metadata

We have confirmed that this shows up in the JSON that is rendered, by loading the page preview and also by loading the page contents from the broker.enter image description here

We have also confirmed that most of the JSON information is received by the page controller in Java.

The Java page controller receives all of the JSON data except for the data in the PageTemplate node. Is there any way that this data can be received by the Java app so that we can use it in our page view?

4

This is a bug with DXA 2.0 release - see https://github.com/sdl/dxa-content-management/issues/14. The issue has been closed, as there has been a fix made, but this is post 2.0. You will either have to upgrade your TBBs to DXA 2.1, or bake your own TBBs containing the (simple) code fix: https://github.com/sdl/dxa-content-management/pull/15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.