Originally posted by ramu av:
hello all,
i'm trying to include a servlet in another servlet using
req.getRequestDispatcher("LeftNavigate").include(req,res);
but on the first access of the calling servlet the "Leftnavigate" servlet is not called.
but on referesh of the calling servlet it includes "LeftNavigate"
please give me some suggestions to handle this problem.
---------------------------------------------
Dear Ramu,
the signature of getRequestDispatcher method is:
request.getRequestDispatcher(String relativePath);
where the relativePath is a path relative to the current page.
so, to solve this problem add the following part to your web.xml file:
<web-app>
...
<servlet>
<servlet-name>Included</servlet-name>
<servlet-class>com.Included</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Included</servlet-name>
<url-pattern>/LeftNavigate</url-pattern>
</servlet-mapping>
...
</web-app>