Do we need ajax to call a servlet in AEM 6.5?
I was trying to call a path type servlet but it didn't work, so i read somewhere that we need to call it through ajax but where should i write the ajax code?
I was trying to call a path type servlet but it didn't work, so i read somewhere that we need to call it through ajax but where should i write the ajax code?
Hi chiragtakkar5,
A servlet can be registered via path using the following property -
Ex :
"sling.servlet.paths=" + "/bin/demo/querybuilder"
There is an OSGi Configuration named Apache Sling Servlet/Script Resolver and Error Handler in the felix console.
It has a property called "Execution Paths(servletresolver.paths)" which holds a list of absolute paths under which the servlet is accessible as a Resource.
By default bin is allowed in the resolver path which is why it works.
If you want your servlet with /api path to be accessible you will need to allow the path in the resolver paths. Please see the screenshot below:

It is recommended to use resource type based servlet over path based now. Please refer the link below:
https://sling.apache.org/documentation/the-sling-engine/servlets.html
Pls check your implementation .Hope this will help you .
Thanks
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.