• Post Reply Bookmark Topic Watch Topic
  • New Topic

A jsp:forward... tag problem

 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI friends,
I used <jsp:forward ... /> tag to transfer control of execution from one JSP to another. The problem is URL is not changing to new JSP name in the address bar.
I am using some addressing to URL to get images and other urls in the new JSP. So the new JSP couldn't locate them.
Please specify how can we change URL.
At present it is very difficult to use <BASE> tag in the forwarded JSP.
Please help
Thanks in advance
Binu
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, forwarding happens entirely on the server side and hence the URL won't change since the user has no idea what is happening there. As far as the client knows, they are asking for data and they are recieving (regardless of where the server actually returns it from)
If you do want the the URL in the client (browser) to change, you need to use response.sendRedirect("url_to_new_page");
This does a complicated thing. It sends a response to the client containing a HTTP header only telling it to look for the page in this new location. The client then sends another request for the page you told it to look for. As such, a redirect involves two HTTP transactions and is less efficient but is required in some cases.
I'm not sure what the problem is that you are having with images, but if you send some code I'm sure someone will straighten it out.
Dave.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!