Expand my Community achievements bar.

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

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

Can i get OSGI service directly from HTL?

Avatar

Level 2

Hello,

Suppose

Public interface MessageService{}


@Component
@Service
public class MessageServiceImpl implements MessageService{}

Getting the service in JSP
----------------------------------------
<%
com.example.service.MessageService msgService = sling.getService( com.example.service.MessageService.class);
%>


same way, How can i get service in HTL ?

1 Reply

Avatar

Level 10

This is not supported in a HTL component. You need to use Sling Models or WCMUsePojo. See: Scott's Digital Community: Creating an AEM HTML Template Language component that uses the WCMUsePojo... .