Matthias,

Its true that object creation can be expensive but you also have to
consider how often the underlying data (assuming it comes from a
database) changes.  In Struts you have ActionForms which are
essentially request scope beans (similar to but not the same as
backing beans).  Its no big deal constantly creating these every
request.

You also want to consider that session beans take up server memory. 
If you have ten different backing beans for ten different pages you
will have ten beans sitting around in memory for each user that goes
through those ten pages (until the session expires.)

In my application we are going to have to use a lot of request scope
beans beacause the data needs to be up to date.  It can be changed by
other users at any time, so we want to show the latest on every
request.  In theory you could have a session bean to avoid recreating
the object and use a scheme to repopulate it but I am not wild about
that.

Anyways that is my .02,

sean


On Fri, 11 Feb 2005 11:35:16 +0100, Matthias Wessendorf
<[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I am just on reading [1]. There is mentioned, that
> object creation is very expensive and you should better
> reuse objects instead of creating them often.
> 
> Now I thought about scope of my backing beans.
> What should be better request or session?
> 
> If I have request scoped backing beans that
> get often created by ONE user and I have MANY
> users... will request scope slow down my web app?
> 
> Ok... application is also there, but that is
> an other stage :-) I would use such a backing
> bean only for *knowing* about ALL users logged
> into the application.
> 
> [1] http://www.oreilly.com/catalog/javapt/chapter/ch04.html
> 
> 
> -Matthias
>

Reply via email to