• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

location bar of the browser on include/forward/sendRedirect

 
Mala R
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've a file1.jsp which is as follows :
<html>
<head>
</head>
<body>
<%= "In FILE1.jsp " %>
<jsp:forward page="file2.jsp" />
</body>
</html>
file2.jsp
----------
<html>
<head>
</head>
<body>
<%= "In FILE2.jsp " %>
</body>
</html>
When accessing file1.jsp in Tomcat as http://localhost:8080/file1.jsp
I get the o/p as "In FILE2.jsp".
The location bar in the browser is the same. i.e http://localhost:8080/file1.jsp
When I replace the <jsp:forward> with
<jsp:include page="file2.jsp" flush="true"/>
still I get the same result and the location bar also reads file1.jsp.
Same is the case with "response.sendRedirect("file2.jsp");
But when I was taking some mock up test,it gave explanation as when response.sendRedirect is used, location bar of the browser would display file2.jsp.
Pls clarify on whne the address bar will display file2.jsp.
Thanks.
 
Tom Adams
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right - when you sendRedirect it updates the Address line in the browser. This is the way your example works for me....
Make sure in your test that you are not seeing a browser cached version of the page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic