Can we invoke a servlet from sling model ? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SantoshSai
SantoshSaiAccepted solution
New Participant
Nov 18, 2022 3:42 PM UTC

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-from-sling-model/m-p/437167 
Hope that helps!

Regards,

Santosh

Santosh Sai

3 replies

SantoshSai
SantoshSaiAccepted solution
New Participant
Nov 18, 2022 3:42 PM UTC

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-from-sling-model/m-p/437167 
Hope that helps!

Regards,

Santosh

Translate
Santosh Sai
rgravisankar
Level 2
Nov 18, 2022 12:46 PM UTC

Hi,

 

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

Translate
Level 3
Nov 18, 2022 12:50 PM UTC

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

Translate