tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kief Morris <>
Subject RE: send redirect question
Date Thu, 30 Nov 2000 14:03:29 GMT
Anand Prasad typed the following on 19:04 29/11/2000 -0800
>Is there way using RequestDispatcher or  sendReDirect()   to send a page to
>particular frame.
>For example.  sendRedirect("index.html" target=_top);

Unfortunately it's the browser which decides which frame to load a page
into, you can't force it on the server side. So a servlet or JSP page can't
decide to load itself into a particular frame any more than a plain HTML
page can decide to load _itself_ into a particular frame.

So if your sendRedirect("index.html") is in myServlet, the HTML which contains
the link tag that loads the original URL has to specify the frame to load 
it in:

<a href="myServlet" target="_top">click</a>

Whatever output myServlet generates, even if it's a redirect, will show up in
the top frame.

A technique to get better control over your framesets is to load a frameset
which is a JSP page, and give it some parameter which will tell it what to
load in each frame. All of your links will contain target="_top", and the 
frameset is loaded:


Your smart_frameset.jsp checks its parameters and writes its frameset tags
accordingly to load the correct URL in each frame. It's not terribly efficient,
since you're reloading the whole frameset whether you need to or not.


               bitBull makes the Internet bite:

View raw message