QuestionQ50

VerifiedGiven a scenario, identify how to implement Sling Models and HTL

A developer must create Sling Models for two fields: name and occupations. The dialog contains two fields: name, a single-value field, and occupations, a multi-value field.

The following code is included in Sling Models inherited from the interface com.adobe.aem.guides.wknd.core.models.Byline:

Question Image

Which method should be used to represent this model in HTL?

Explanation

getOccupations() returns a List<String>, so the HTL expression should use @ join=', ' to render the multi-value occupation list as comma-delimited text. The Sling Model should be referenced through the com.adobe.aem.guides.wknd.core.models.Byline interface, while the single-valued name is rendered directly. Adobe’s WKND HTL guidance uses this exact interface binding and join expression for the Byline component.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!