This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Managed ben doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Managed ben doubt" Watch "Managed ben doubt" New topic
Author

Managed ben doubt

Maya Pillai
Ranch Hand

Joined: Jul 17, 2008
Posts: 60
Hi,

In my application all the managed beans are in scope session. Will it cause any performance issue? Do we need to serialize this bean objects.

Can anyone tell me the best approach. I am using jsf1.2

Thanks.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Well yes. The data must be stored somewhere, in memory or on disk.
Only data that needs to be stored you should store and for other classes you should make them stateless.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

If you have a choice, you should use request scope instead of session scope. That's because the server has to keep objects on a long-term basis, and the more objects you're keeping, the more RAM it eats up. Request scope objects exist only while a request is active, so they take a smaller "bite",

However, JSF does tend to force you to use session scope in a lot of cases where you wouldn't otherwise have to. JSF2 eases some of this by adding View scope.

Session scope objects (including non-JSF session-scope) objects need to be serializable. Some appservers will get very annoyed if you don't declare session objects as serializable. That's because if the appserver needs to free up memory by "paging" objects out or if the appserver needs to transfer the session to another VM, the data must be serialized/deserialized.

Of course, if you say something's serializable, you must mean it. Otherwise, if the data goes through serialization/deserialization, the deserialized copy of the object may be missing critical information.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Managed ben doubt
 
Similar Threads
Another JSP Problem - Database related
How to use SwitchAction using NetBeans5.5
Oracle to buy BEA???
how can i Pass an object from an Action to jsp page in struts?
SOLVED: how to set locale in Filter struts 2