Component Placeholder i JSP | Community
Skip to main content
Huntwer
Level 2
May 25, 2018
Solved

Component Placeholder i JSP

  • May 25, 2018
  • 5 replies
  • 2254 views

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

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

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)%>"/>

5 replies

smacdonald2008
Level 10
May 25, 2018

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

Huntwer
HuntwerAuthor
Level 2
May 25, 2018

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

Thanks for reply

Huntwer
HuntwerAuthorAccepted solution
Level 2
May 25, 2018

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)%>"/>

smacdonald2008
Level 10
May 25, 2018

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!

Huntwer
HuntwerAuthor
Level 2
May 25, 2018

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