I created two servlets A and B.
From A I forwarded to servlet B.In servlet B I call methods getContextPath() , getServletPath() , getRequestURI() , getQueryString() , getPathInfo() . And I get values as I have actually made a request to servlet B directly.
But when I replace forward() with include() all those methods that I called previously return the values for the request I made for servlet A .
Can someone put some more light why in case of include it behaves diffferently.We must be making a request to resource no matter forward or include.
From A I forwarded to servlet B.In servlet B I call methods getContextPath() , getServletPath() , getRequestURI() , getQueryString() , getPathInfo() . And I get values as I have actually made a request to servlet B directly.
But when I replace forward() with include() all those methods that I called previously return the values for the request I made for servlet A .
Can someone put some more light why in case of include it behaves diffferently.We must be making a request to resource no matter forward or include.