Exam4Training

Which two implementations will support this HTL snippet?

A custom component has one dialog field:

The developer needs to implement a Sling Model to perform a business logic on the authored value.

The developer writes the following HTL snippet.

Which two implementations will support this HTL snippet? (Choose two.)

A)

B)

C)

D)

A . Option A
B. Option B
C. Option C
D. Option D

Answer: BD

Explanation:

Option B and Option D are two implementations that will support the HTL snippet. Option B uses the @Model annotation with the adaptables parameter set to Resource.class. This allows the Sling Model to adapt from a resource object and access its properties using the ValueMap interface. Option B also uses the @Inject annotation with the name parameter set to “./text” to inject the value of the text property into the text field. Option D uses the @Model annotation with the defaultInjectionStrategy parameter set to OPTIONAL. This allows the Sling Model to use optional injection for all fields and avoid null pointer exceptions if a property is missing. Option D also uses the @Inject annotation without any parameters to inject the value of the text property into the text field, using the field name as the default property name.

Reference:

https://sling.apache.org/documentation/bundles/models.html

https://experienceleague.adobe.com/docs/experience-manager-htl/using-htl/htl-block-statements.html?lang=en#use

Latest AD0-E134 Dumps Valid Version with 50 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version