Servlets
Servlets is a way of accessing the data through request and expects a response in the form of json , text , xml. Note: 2 things to remember in servlet , registering and consuming the servlet. Below annotation(OSGI Annotations) are used for a Servlets @Component ( service = { Servlet . class } , property = { "sling.servlet.methods=post" , " sling.servlet.extensions= json ", " sling.servlet.selectors= home " , " sling.servlet.resourceTypes= apps/components/testcomponent ", " sling.servlet.paths=/bin/sampleservletPath " } ) In AEM servlets are mostly used to get the json data which is stored. Servlet can be registered in 2 ways mentioned above (Pink and blue color) 1) With Path 2) With resourceType. When regestering with Path, you need to make sure the path is added in Apache Sling Servlet / Script Resolver and Error Handler OSGi configuration as below i.e., path can be added /bin/sampleservletPath . There might be multiple ...