ExamGecko
Question list
Search
Search

Related questions











Question 13 - AD0-E134 discussion

Report
Export

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
Answers
A.
Option A
B.
Option B
Answers
B.
Option B
C.
Option C
Answers
C.
Option C
D.
Option D
Answers
D.
Option D
Suggested answer: B, D

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-blockstatements.html?lang=en#use

asked 02/10/2024
Assane SENE
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first