• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

location bar of the browser on include/forward/sendRedirect

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic