Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How do we run our code in debug mode in aem. I have a codebase with aem archetype .

Avatar

Level 3

Hi All,

I need to use aem debug feature for testing purpose

I need to see how the java code is invoked in response to the changes in UI side, say a mouseclick.

I need to know how a particular htl class gets a value.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi


Please check this article which shows step-by-step how to achieve that:
https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-a...
https://aemgeeks.com/aem-debugging/how-to-start-aem-in-debug-mode/ 

The only thing you need to know is where in your codebase (java classes) to "set a breakpoint", you can know that easily just by checking what "sling model" is invoked from your HTL class, for example:

<!--/* HTL *--> 
<div data-sly-use.model="com.myproject.models.HelloWorldModel">
<h1 class="cmp-helloworld__title">${model.title}</h1>
</div>

In the above line, the java class is HellowWorldModel.java which is under the package "com.myproject.models"

And the value ${model.title} will come from the method "getTitle()" from the model. So you would need to add a breakpoint in the "getTitle()" method from your model once the debugger is started.

 

Hope this helps

 

Learn more about sling models and HTL here: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-wknd-tutorial-devel...



Esteban Bustamante

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi


Please check this article which shows step-by-step how to achieve that:
https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-a...
https://aemgeeks.com/aem-debugging/how-to-start-aem-in-debug-mode/ 

The only thing you need to know is where in your codebase (java classes) to "set a breakpoint", you can know that easily just by checking what "sling model" is invoked from your HTL class, for example:

<!--/* HTL *--> 
<div data-sly-use.model="com.myproject.models.HelloWorldModel">
<h1 class="cmp-helloworld__title">${model.title}</h1>
</div>

In the above line, the java class is HellowWorldModel.java which is under the package "com.myproject.models"

And the value ${model.title} will come from the method "getTitle()" from the model. So you would need to add a breakpoint in the "getTitle()" method from your model once the debugger is started.

 

Hope this helps

 

Learn more about sling models and HTL here: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-wknd-tutorial-devel...



Esteban Bustamante