You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin Gibbs <ke...@ramesys.com> on 2000/09/14 09:52:34 UTC

Newbie: Bean scope & Frames

I seem to be having a problem with bean scope when used with frames.

Example:
My action stores a bean as a request attribute and then forwards the request
to a jsp page - frames.jsp for arguments sake which simply defines a
frameset and some frames.
Now, within frames.jsp the bean is visible i.e. <struts:ifAttributeExists
...> is true, but the jsp pages in the "src=jsppage.jsp" cannot see the
attribute.
I don't want to store these beans as session attributes, as there could well
be quite a few within the total application (worried about resources etc).

So, does anyone else have a problem with this (or am I doing something
silly)?
Does anyone have some example code they wouldn't mind sharing which shows a
frame based jsp using request attribute beans?

Many Thanks - Kevin
----------------------------------------------------------------------------
---------
Kevin Gibbs	Email: kevin.gibbs@ramesys.com

Ramesys (AEC) Limited	Tel: +44 (0)29 2079 2260 Ext 201
1 Pascal Close	
St Mellons	Fax: +44 (0)29 2079 2504
Cardiff, UK		
CF3 0LW	Url: http://www.ramesys.com/aec



Re: Newbie: Bean scope & Frames

Posted by James Strachan <ja...@metastuff.com>.
HTTP frames are implemented as multiple HTTP requests as they are multiple
documents  - hence any request scope variables for the first outer frame
document is not available for for inner frame documents.

Try adding your action and logic to when your inner frame document
"jsppage.jsp" is requested rather than the outer frame "frames.jsp".

Regards
James

James Strachan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
web: http://www.metastuff.com
mail: james@metastuff.com

----- Original Message -----
From: "Kevin Gibbs" <ke...@ramesys.com>
To: <st...@jakarta.apache.org>
Sent: 14 September 2000 08:52
Subject: Newbie: Bean scope & Frames


> I seem to be having a problem with bean scope when used with frames.
>
> Example:
> My action stores a bean as a request attribute and then forwards the
request
> to a jsp page - frames.jsp for arguments sake which simply defines a
> frameset and some frames.
> Now, within frames.jsp the bean is visible i.e. <struts:ifAttributeExists
> ...> is true, but the jsp pages in the "src=jsppage.jsp" cannot see the
> attribute.
> I don't want to store these beans as session attributes, as there could
well
> be quite a few within the total application (worried about resources etc).
>
> So, does anyone else have a problem with this (or am I doing something
> silly)?
> Does anyone have some example code they wouldn't mind sharing which shows
a
> frame based jsp using request attribute beans?
>
> Many Thanks - Kevin
> --------------------------------------------------------------------------
--
> ---------
> Kevin Gibbs Email: kevin.gibbs@ramesys.com
>
> Ramesys (AEC) Limited Tel: +44 (0)29 2079 2260 Ext 201
> 1 Pascal Close
> St Mellons Fax: +44 (0)29 2079 2504
> Cardiff, UK
> CF3 0LW Url: http://www.ramesys.com/aec
>
>
>


Re: Newbie: Bean scope & Frames

Posted by Giuseppe Galli <gi...@agora.it>.
Your problem is easy to understand: if you put your data as request attribute
building a frameset  results in loosing the data when the jsp pages are called:
the requets are different, while the user session is the same. What about using
page inclusion <jsp:include page=""> instead of building a frameset?

Pino.

Kevin Gibbs wrote:

> I seem to be having a problem with bean scope when used with frames.
>
> Example:
> My action stores a bean as a request attribute and then forwards the request
> to a jsp page - frames.jsp for arguments sake which simply defines a
> frameset and some frames.
> Now, within frames.jsp the bean is visible i.e. <struts:ifAttributeExists
> ...> is true, but the jsp pages in the "src=jsppage.jsp" cannot see the
> attribute.
> I don't want to store these beans as session attributes, as there could well
> be quite a few within the total application (worried about resources etc).
>
> So, does anyone else have a problem with this (or am I doing something
> silly)?
> Does anyone have some example code they wouldn't mind sharing which shows a
> frame based jsp using request attribute beans?
>
> Many Thanks - Kevin
> ----------------------------------------------------------------------------
> ---------
> Kevin Gibbs     Email: kevin.gibbs@ramesys.com
>
> Ramesys (AEC) Limited   Tel: +44 (0)29 2079 2260 Ext 201
> 1 Pascal Close
> St Mellons      Fax: +44 (0)29 2079 2504
> Cardiff, UK
> CF3 0LW Url: http://www.ramesys.com/aec