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.
I would like to know somethin about request dispatcher basically i do some processing in a servlet and forward output to a jsp. What i would like to know is when the request gets forwarded to the jsp so like in the internet explorer address bar will u see the address of the servlet or jsp.I have a doubt out here coz in my address bar it shows me the address of the servlet though the output gets forwarded to jsp.Why is it so i thought forwarding to jsp means the jsp page should be displayed along with the address of the jsp page in the address bar not servlet. Pls help
There are two ways we can forward to another resource. One is response.sendRedirect() which changes the url in your browser and Second is requestDispatcher.forward() which does not change the url in your browser. In the First case webcontainer returns the control back to browser and browser sends the request to new url. In the second case web container forwards the request to new url and it is transparent to the browser hence no change in the url in the browser.
There are two ways we can forward to another resource ... One is response.sendRedirect()
Not entirely accurate. The term "forward" is meant to mean that the request processing is passed along to another resource (such as a JSP or another servlet) within the context of the same request. A "redirect" on the other hand, causes a new request to be generated. And yes, in the case of the forward, since all passing-things-about happens on the server side, the browser has no idea what's going on an will continue to display the URL of the initial resource. In the case of a redirect, the browser is instructed to create a new request to the new resource and so will update the URL to that resource. hth, bear