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

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

Mark Solution

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

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 답변 개

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... .