There is a big difference between the javax.servlet.include.* and the javax.servlet.forward.* attributes.
Section SRV.8.3.1 of the spec speaks about the javax.servlet.include.* attributes in these terms:
Except for servlets obtained by using the getNamedDispatcher method, a servlet that has been invoked by another servlet using the include method of RequestDispatcher has access to the path by which it was invoked. [...]their values must be equal to the request URI, context path, servlet path, path info, and query string of the included servlet, respectively. If the request is subsequently included, these attributes are replaced for that include.
Whereas in section SRV.8.4.2, it states the following for the javax.servlet.forward.* attributes:
Except for servlets obtained by using the getNamedDispatcher method, a servlet that has been invoked by another servlet using the forward method of RequestDispatcher has access to the path of the original request. [...] The values of these attributes must be equal to the return values of the HttpServletRequest methods getRequestURI, getContextPath, getServletPath, getPathInfo, getQueryString respectively, invoked on the request object passed to the ﬁrst servlet object in the call chain that received the request from the client.
I didn't know either that it worked that way. I supposed that both forward and include's attributes were giving the original request parameters. But it seems that both behave differently. [ April 30, 2007: Message edited by: Sergio Tridente ]
Yes, you are right. They are usuful in the case we include/forward one servlet from another. (Just to make it clearer, when I say servlet I mean both the servlets generated from java classes implementing Servlet and/or HttpServlet or the servlets created from JSP pages.)