Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Can we invoke a servlet from sling model ?

Avatar

Level 4

Can we invoke a servlet from sling model ?

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi,

 

From sling mode, its recommended call sling services instead of sling servlet. Could please give more detail on your scenario?. Thanks.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 2

Hi,

 

From sling mode, its recommended call sling services instead of sling servlet. Could please give more detail on your scenario?. Thanks.

Avatar

Level 4

@rgravisankar there is no scenario in which i want to use it, but,  I just want to know whether it is possible to access a servlet from sling model or not.

Avatar

Community Advisor

Hi @rgravisankar

IMHO, as @rgravisankar says, it's not a good practice to call a servlet from a model. Using services makes more sense. To get answer, please read similar thread here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/call-a-servlet-get-request... 
Hope that helps!

Regards,

Santosh