Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
JeetendrakumarSaAccepted solution
Level 2
Sep 27, 2024 2:06 PM UTC

HI @narendiran_ravi, issue finally found not in the AEM, that need to check in the front-end code 🙂

9 replies

BrianKasingli
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 26, 2024 5:48 PM UTC

Well, first of all you need to make sure your SlingModel is initiated... and then your using the correct Sling Annotations to pull jcr properties into that component. like @ValueMapValue private String text;... next, you need to ensure that your TextUtil is also working as expected.

 

 

HTL <a href="${model.urlLink}">${model.formattedText}</a> Sightly ... @ValueMapValue private String urlLink; @ValueMapValue private String text; public String getUrl() { return LinkUtils.formatLink(urlLink); } public String getFormattedText() { return TextUtil.reformatText(text); }

 

 

 

for testing sale, making sure if your Sling Model is returning string from the backend as expected, you can do something like this:
public String getFormattedText() {
   return "I love sourcedcode.com!";
}

 

References (Sling Model Annotations CheatSheet): https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide#ValueMapValue

 

 

Translate
Level 2
Sep 27, 2024 4:17 AM UTC

Handled correctly only but formatting not works:

 

Translate
BrianKasingli
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 27, 2024 4:35 AM UTC

Hello, your link TextUtil must be not working as expected…. 

you can simple return hard coded text, to see if the method is retuning anything correct, and if so, must be your TextUtil. Something is not working there. 

public String getFormattedText() {
   return "I love sourcedcode.com!";
}

Translate
h_kataria
Community Advisor
Community Advisor
Sep 27, 2024 5:22 AM UTC

When you say it is not working. Could you elaborate that a little ? 

Translate
Level 2
Sep 27, 2024 6:14 AM UTC

For example, the formatting is applied to the text field which is working fine in 1 component but not working for the other.

Translate
narendiran_ravi
Level 6
Sep 27, 2024 11:39 AM UTC

You can debug or add logs to see if the Util method gives the expected output.

Translate
JeetendrakumarSaAuthorAccepted solution
Level 2
Sep 27, 2024 2:06 PM UTC

HI @narendiran_ravi, issue finally found not in the AEM, that need to check in the front-end code 🙂

Translate