I am looking forward to know the following aspects related getNamedRequestDispatcher(String)
Any pointers would be useful.
Why request attributes for forwarding and request are not added into getNamedRequestDispatcher()
The specifications give no explanation "why they should not be set", they only tell that they should not be set. The only logical explanation I can think of is that the getNamedRequestDispatcher() can be used to forward or include to Servlets that are configured in the web.xml without a <servlet-mapping>. It is actually the only way to reach a Servlet or JSP that cannot be reached directly by the client.
Probably the guys who wrote the specs thought that you would be interested in the request attributes (like "javax.servlet.forward.request_uri") until you have reached the point of using Servlets that are "protected from the outside URLs". If you are still interested in these parameters then you can still add them as an attribute to the request yourself though....
What's the practical use of getNamedRequestDispatcher()
Getting to Servlets in your web-application that should not be reached directly from a client
I am just wondering what is the practical use? Do we use getNamedDispatcher() pretty often?
I haven't other than during my certification preparation... and nowadays with all the mvc-frameworks around we hardly configure Servlets other than the ControllerServlet in the web.xml. I doubt if those frameworks use the getNamedDispatcher() "under the hood" at all.