• Post Reply Bookmark Topic Watch Topic
  • New Topic

when to create beans in session

 
Jorge Fiallega
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to create some business object when I select a specific menu item in my page.

When I was using Struts I could check the existance of such an object in the action class correspoding to the menu item. If the object did not exist I could create one and added to session. After the execute method is done the requested page will be sent and by then I will have the desired object in session.

How do I acomplish this using JSF?. When I select a specific menu item JSF takes over in its life cycle and a page is rendered and return to me, but I was not able to create the business object in session.

Thanks

Jorge Luis
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create your object in your action method [or even in your event listeners or even in your converters, validators ... infact anywhere in the life cycle]
 
Jorge Fiallega
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that there is none of those methods available. the menu item clicked is not a JSF component therefore it is not attach to an action, validation, listener,.. . The menu item is a link to a page with JSF components but by the time the jsf page display I need the business object to exist in session.
Again, the object in session needs to be created after the click of the link and before the new page with JSF components displays.

It is a very simple but fundamental problem I think.

Thanks

Jorge Luis
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!