4

I inherited a Tridion 2013 page that has a metadata field set to "Embedded Schema", with "allow multiple values" checked.

I am trying to access these values on a JSP page from the pageModel. The page model is just the default from DXA com.sdl.webapp.common.api.model.PageModel

pageModel.meta seems to be returning ONLY the first value, with the key and value sent as separate entries, and none of the additional values showing up at all.

In other words, if these were my values

MultipleField
- exampleKey1 exampleValue1
- exampleKey2 exampleValue2
- exampleKey3 exampleValue3

and if this was my code (much simplified)

<jsp:useBean id="pageModel" type="com.sdl.webapp.common.api.model.PageModel" scope="request" />
<c:forEach var="meta" items="${pageModel.meta.entrySet()}">  
${meta.key}  ${meta.value}  
</c:forEach>

What I would get back would be

MultipleFieldKey exampleKey1
MultipleFieldValue exampleValue1

None of the other values would show up at all.

Am I accessing this wrong? Or was the metadata set up improperly in Tridion?

  • Is the field defined correctly, as a List<>, in the pageModel? – Jacques Kors Feb 4 '18 at 8:01
  • Can you edit your question and add the source of your Page Model? – Bart Koopman Feb 5 '18 at 9:23
  • I added the PageModel source. The meta field is a HashMap. – sunamc1 Feb 5 '18 at 14:52
3

The pageModel.meta is defined for the HTML meta tags, it is actually not supposed to map to the CMS Page metadata.

For mapping CMS Page metadata, you should extend the default Page Model and add these fields yourself, just like you do in Entity Models.

  • Thanks, I thought it might be something like that. I'll give it a try and report back. – sunamc1 Feb 6 '18 at 18:38

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.