내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Sling Model not showing complete details -- Sling model to JS

Avatar

Level 4

Hi Team

 

I have a sling model which I am using in htl file but I few values are not getting printed. 

 

<sly data-sly-use.helper="${'com.****.aem.****.helpers.SampleModel'}"/>

<p> address is ${helper.deliveryAddress.firstName} </p>

 

My deliverAddress() method is having some address details like firstName, line1, line2, street

I am able to print firstName and line1 but not line2 and street. 

 

There is another sling model which is able to retrieve all  firstName, line1, line2, street which I used that sling model in my htl file it is printing however printing in some other htl file.

 

Kindly help me if I am doing any mistake.

 

Also let me know how to take value from sling model to js so that I can see what deliveryAddress() is printing.

 

Thanks and Regards

Prashanthi

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor and Adobe Champion

Most likely you are missing the proper context, If the value contains some special character HTL will avoid printing the values for security reasons, that's why you should always use the proper context. 


Try something like this:

<p> address is ${helper.deliveryAddress.firstName @ context='html'} </p>

Please read more about context here: https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#121-display-context 



Esteban Bustamante

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Community Advisor

Hi @Prashardan 

 

Try adding a debugger in your code. Check what values are flowing into the code before you fetch them into your HTL. 

Start your AEM local instance in Debug mode. 

Follow this document to check how to debug AEM : https://aemgeeks.com/aem-debugging/how-to-start-aem-in-debug-mode/

 

Check if the line2 values is coming into your Sling Model. 

 

Also if your use the debugger you would not have to get the value in JS to see it. 

You can also try printing helper.deliveryAddress to see what exactly is coming from Sling model. 

 

Thanks

 

 

Avatar

Community Advisor

@Prashardan ,

We need to look at your sling model and the HTL file to guide you better with your issue. Please post your sling model and htl file if you can.

Avatar

정확한 답변 작성자:
Community Advisor and Adobe Champion

Most likely you are missing the proper context, If the value contains some special character HTL will avoid printing the values for security reasons, that's why you should always use the proper context. 


Try something like this:

<p> address is ${helper.deliveryAddress.firstName @ context='html'} </p>

Please read more about context here: https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#121-display-context 



Esteban Bustamante