On 2/20/07, Steve Torrefranca wrote:
Does it have to be a managed bean?
I am afraid so, though i could be wrong. The List is used by the view
as source for select Items. But yes I can use this a work around.
It's not really a "workaround".

The only thing special about managed beans are the fact that they can
get created for you, as a side effect of evaluating an expression.
But after creation the server actually puts them into one of the
normal scopes:

* Request scoped managed bean --> request attribute

* Session scoped managed bean --> session attribute

* Application scoped managed bean --> ServletContext attribute

Therefore, using a ServletContextListener to preinitialize your
application scoped managed bean is fine ... all you have to ensure is
that the attribute name you store it under is the same as the managed
bean name. Later on, then, the managed bean facility will find that
the bean already exists, so it will not bother to create it.


Thanks man!


Simon Lessard wrote:
Hello Steve,

Does it have to be a managed bean? You could probably chose a class
with static methods instead and have the context listener initialize
it upon application startup. You could then create a really
lightweight application bean extracting its data from that class with
static members. Forcing a bean into existence at application startup
can be extremelly hard as JSF VariableResolver requires a FacesContext
instance which is based on a request that you won't have inside the
listener to evaluate a value.


~ Simon

On 2/20/07, *Steve Torrefranca* <storrefranca@branders.com

Hows that may I ask? A getter needs to be called in order to
populate a
List that is DB driven

List theList = null;

public List getTheList(){
if(theList == null)
theList = getTheListFromDB();

return theList;

David Delbecq wrote:
a webapp context listener
En l'instant précis du 02/20/07 15:28, Steve Torrefranca
s'exprimait en
ces termes:
what is the best way to do this?

thank you


Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 7 | next ›
Discussion Overview
groupusers @
postedFeb 20, '07 at 2:31p
activeFeb 20, '07 at 6:34p



site design / logo © 2018 Grokbase