• Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving managed bean's data without using session scope  RSS feed

 
Liron Golan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a configuration that includes several managed beans and the user can hop between one configuration screen to the other (This is not a wizard).
I would like to be able to save managed bean data while the user changes the configuration without saving the managed bean in the session (request scope is not a solution in my case as well).

I read that myFaces Orchestra and Tomahawk have a solution for that.
Does anyone know what would be the best solution and the easiest to implement?

Thanks,

Liron.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using forms, use h:inputHidden.

Orchestra provides you the 'conversation scope'.

Tomahawk provides you the t:saveState component which acts like h:inputHidden, but with the advantages that you don't need forms and also not a converter if the value is not supported by the JSF defaule converters (i.e. not a String/Number/Boolean/Enum).
 
Liron Golan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thing is that there are many fields in each form (each form has a managed bean). I would like to keep the same instances of these managed bean while the user fills the forms and only when the user closes the configuration that he was working on - remove the managed beans from memory.

Please help,

Thanks,

Liron.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Liron,

Can I ask why you can't save the beans in the Session Scope?
 
Liron Golan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would prefer not to save the managed beans in the session since i have several configurations that use the same managed beans.
If i save the managed beans in the session i would have to reset or remove the reference of each managed bean before i can switch to a different configuration.

Thanks,
Liron.
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Liron Golan:
I would prefer not to save the managed beans in the session since i have several configurations that use the same managed beans.
If i save the managed beans in the session i would have to reset or remove the reference of each managed bean before i can switch to a different configuration.

Thanks,
Liron.


Possibly, but it may be simply that you're not looking at the problem in the proper way. Unfortunately, without more specific info, I couldn't say.
 
Liron Golan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will try to elaborate,

I have a configuration that includes many parameters and settings for a certain system. Since there are so many i devided them logically to several pages and managed beans.
When the user opens the configuration he sees a menu where he can switch between each page in that specific configuration (just like any normal navigation menu).

The thing is that there can be many configurations like that. Not just one.
So if for example i open 'conf1' and all the managed beans are created and saved in the session, when i open 'conf2' it would use the same already created beans.

Note that all windows opened by my program use the same session (That cannot be changed).

I don't want to use request scope either cause then when the user navigates in the menu, the system would create a new managed bean instance every time i hit a page.

How would you approach this problem.

Thanks so much!

Liron.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you thought about saving off _Configurations_ in the session, e.g. A user can have conf1 and conf2 in session.

Each configuration would have their own managed bean instances.
 
Liron Golan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The user can create unlimited configurations each uses the same managed bean since it's the same format, just different content according to what the user set.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!