AEM - HTL Use-API | AEM Community Discussion | Community
Skip to main content
kautuk_sahni
Community Manager
Community Manager
August 25, 2020

AEM - HTL Use-API | AEM Community Discussion

  • August 25, 2020
  • 0 replies
  • 725 views

BlogImage.jpg

AEM - HTL Use-API by Adobe Docs

Abstract

HTL encourages separation of concerns by not allowing business logic to mix with markup. Business logic can be implemented through the Use-API.
The following table gives an overview of the advantages and disadvantages of each API.

For page components, it is recommended to use a mixed model, where all model logic is located in Java, providing clear APIs that are agnostic to anything that happens in the view (i.e. within the components). AEM comes with great default models like the Page or the Resource API that should be able to cover most cases.
All view logic that is specific to a component should be placed within that component as JavaScript, because it belongs to that component.

Java Use-API
1. Faster | Can be inspected with a debugger | Easy to unit-test
2. Cannot be modified by front-end developers

JavaScript Use-API
1. Can be modified by front-end developers| Is located within the component, keeping the view logic of a component close to its corresponding template
2. Slower| No debugger (yet) | Harder to unit-test

Read Full Blog

AEM - HTL Use-API

Q&A

Please use this thread to ask the related questions.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.