This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, The Web Services Tutorial (1.4) says that: p665... "When a request is forwarded, the request URI is set to the path of the forwarded page. The original URI and its constituent parts are saved as request attributes javax.servlet.forward.[request_uri|context-path|servlet_path|path_info|query_string]." The first sentence is true but I cannot find the attributes mentioned in the second sentence anywhere in the request which arrives in the forwarded resource (in my case, it is a servlet). Please can someone explain where these attributes can be found? Also, if they are there somewhere, then do the names mentioned in the tutorial represent String vales for the names used to retrieve the attributes? I am using Tomcat 4.1.24 on Windows XP in case it is relevent... Thanks Ian
Hi, When u forward the request to the another page using the forward method, u can access all the request parameters on the new page. As far as the statement is saying, it might be internally transmitting it as attributes but still u can access ur request parameters with request.getParameter method or if u have set any attributes urself, u can access them by request.getAttribute("<attribute name>").
"Failure is not when you fall down; its only when you fail to get up again."
Joined: Dec 18, 2003
Shankar, Thanks for your reply but perhaps I did not fully explain my question... If I 'include' another servlet and then look in the request passed into the 'included' servlet doXXX method then I do indeed see some attributes which the server has created - in other words I don't have to do anything except retrieve these attributes using the names given in the tutorial. However, if I 'forward' to a servlet, there are no added attributes in the request when it arrives in the 'forwarded' resource. This seems to be at odds with what the tutorial suggests - in fact there is also an objective in SCWCD 1.4 which mentions these attributes but I don't know why the forwarding mechanism is not establishing them. Regards Ian