Custom Servlet Paths in CQ5
If you need to write a servlet in CQ5, say to handle form submission or something, you will undoubtedly have turned to your CQ5 Advanced Training guide (right?) or used your favorite search engine to find how-to help on the interweb... You may have noticed that almost every tutorial has an example servlet path that looks like one of the following:
<form action="/services/mycompany/ShippingDetailsServlet" method="post"> or
<form action="/bin/some/example" method="post">
Then, when you try to create one yourself, you use something like:
<form action="/mycompany/myservlet/" method="post">
(i.e. something other than 'bin' or 'service') only to get a 404 resource not found error... Here's how you add custom servlet paths in CQ:
Go to the Felix Console Config UI: http://<your-instance>:<port>/system/console/configMgr
Find the "Apache Sling Servlet Resolver" bundle (I use search)
Click on it
Under "Execution Paths" add a new entry
Add your custom servlet path
That's it! Enjoy...










