File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
Unwanted bean instantiation when clicking a link
Joined: Jan 30, 2003
Nov 06, 2008 12:57:00
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 h
utputLink, 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.
I agree. Here's the link:
subject: Unwanted bean instantiation when clicking a link
insert a new row in a datatable
Show modal from rich:picklist onlistchanged?
c:forEach is not working
Validation error while trying to change a value in a request scope bean
HashMap mapped property / action form
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015