Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Can we invoke a servlet from sling model ?

Avatar

Level 3

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 3

@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