Hi All,
Can Anyone Provide me a working Solution for below :
I need to forward servlet request from Servlet 1 to Servlet 2.
RequestDispatcher rd = request.getRequestDispatcher("/com/testform");
rd.forward(request, respo);
where "/com/testform" is my Servlet 2 Sling Path.
It's not able to forward and seems like not able to find this above path.
Please provide me a working solution ASAP.
Solved! Go to Solution.
Views
Replies
Total Likes
Best practice to register a servlet is using resource type. If you still want to go with path, then by default only '/bin/' is allowed in the OSGI sling servlet resolver and dispatcher.any file. So please check whether the path '/com/testform/' is allowed on both the places.
A Single request can be created once at a time. In your case, you are trying to create multiple servlet requests.
No.
Please check RequsetDispatch implementation and how to redirect request from one servlet to another.
Hi, I don't find here creating multiple servlet request.
If you can check the code snippet above,
This is the syntax that we follow .
To forward any servlet request from one to another, it involves 2 steps as below:
1. Create request dispatcher object (here it is 'rd')
2. and use that object in forward method.
RequestDispatcherOBJECT.forward(SlingRequest, SlingResponse)
Best practice to register a servlet is using resource type. If you still want to go with path, then by default only '/bin/' is allowed in the OSGI sling servlet resolver and dispatcher.any file. So please check whether the path '/com/testform/' is allowed on both the places.
hello @PriyankaDatta ,
Hope you have already got the solution for the above. If not please check the below Url if it helps
Please make sure your servlet path is configured as allowed paths in the Configuration Manager
Views
Likes
Replies
Views
Likes
Replies