Expand my Community achievements bar.

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

Component Placeholder i JSP

Avatar

Level 2

Hi guys!

I have a component whose rendering comes from a JSP script. In Sightly I show the component placeholder with this code:

<sly data-sly-test="${wcmmode.edit}">

     <div data-emptytext="Click here to edit this component" class="cq-placeholder"></div>

</sly>

How do I get the same for JSP?

Thanks advance for the help me

1 Accepted Solution

Avatar

Correct answer by
Level 2

I have solved it. For anyone who comes across the same problem, this is the solution:

<cq:text escapeXml="true" placeholder="<%= Placeholder.getDefaultPlaceholder(slingRequest, "Click here to edit component", null)%>"/>

View solution in original post

5 Replies

Avatar

Level 10

If you are using HTL - you should keep using it as that is best practice - JSP is no longer considered best practice for AEM development

Avatar

Level 2

Ok, but I'm using JSP for this component, not HTL. Is there a way to do it in JSP?

Thanks for reply

Avatar

Correct answer by
Level 2

I have solved it. For anyone who comes across the same problem, this is the solution:

<cq:text escapeXml="true" placeholder="<%= Placeholder.getDefaultPlaceholder(slingRequest, "Click here to edit component", null)%>"/>

Avatar

Level 10

That is great - however the use of JSP is NOT best practice. So ppl following this pattern are following a bad practice. Adobe strongly recommends HTL over JSP!

Avatar

Level 2

I'm learning to use AEM. I wanted to understand how it works. What I'm doing isn't a true webpage.