aspose file tools*
The moose likes JSF and the fly likes Unwanted bean instantiation when clicking a link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Unwanted bean instantiation when clicking a link" Watch "Unwanted bean instantiation when clicking a link" New topic
Author

Unwanted bean instantiation when clicking a link

Wally Hartshorn
Ranch Hand

Joined: Jan 30, 2003
Posts: 77
ListBean is the backing bean (request scope) for a list of links to items. The constructor can take quite awhile to run (e.g. 30 seconds).

ItemBean is the backing bean for an individual item. The constructor runs quite quickly (e.g. 1 second).

A user goes to the List screen, and the ListBean constructor runs and generates a list of links to items. The links were created by t:commandLink tags.

The user clicks on an item in the list to view the item's details.

The ListBean constructor runs again, taking 30 seconds to do so, even though we don't actually want to do anything with the ListBean.

Finally, the ItemBean constructor quickly runs and the item details are displayed.

How can I avoid the unnecessary running of the ListBean constructor? I have "immediate='true'" on the t:commandLink tags, but of course that doesn't prevent the constructor from running.

I'm guessing my only real option is hutputLink, but so far as I know I can't specify a method to be run the way I can with t:commandLink, nor can I attach an actionListener to it.

I suppose another possibility is to change the ListBean to session scope, but then I need to modify my logic to ensure that the bean is refreshed when the list screen is displayed.

Any ideas?


Wally Hartshorn
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unwanted bean instantiation when clicking a link