tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Frames and request
Date Thu, 30 Jun 2005 15:59:38 GMT
On Thu, June 30, 2005 11:32 am, Carlos Bracho said:
> Hello.
> I am working with frames (I know it's a bad practice... but I cannot do
> anything about it) well the problem is:

Whoever told you using frames is a bad practice was probably scared of
them :)  I find a lot of people see that it takes a little extra effort
and they run away like their hair was on fire.  Using frames is like using
any other technology... if you understand it, and know the pros and cons,
you can do things you could never do otherwise.

But I digress...

> I have one jsp file (outter.jsp) which has 2 frames (inner1.jsp and
> inner2.jsp), when I forward to outter.jsp I can see the request's
> attribute,
> but inner1.jsp and inner2.jsp does not have access to the request's
> attribute, in fact the have a new request and of course that request does
> not have the attribute I set before.

That's right... each frame is a separate request.  You have to think of
them as completely separate browser windows, because thats exactly what
they are.  They just happen to share a session.

There are ways to do what you want... if you are not script-averse, you
can grab the attributes you want from the request associated with
outter.jsp, put them in some Javascript variables, and then access them
from the inner frames using parent.name_of_variable_here (although I've
always used, they should both

Alternatively, you can add a query string to the URLs that you populate in
the inner frames from the outer frame, something like:

<frameset rows="100,*">
  <frame name="top"
  <frame name="bottom"

In the case of the first approach, the attributes are only accessible to
your client-side code, i.e., you can't get at them from within a JSP

The second will allow you to access them in both client-side code and
server-side code.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message