Why not just get the bean right from the session attribute map?

Jeremy Sager
Data Communications Product Manager
Chesapeake System Solutions
410.356.6805 x120
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 26, 2006 2:20 PM
To: 'MyFaces Discussion'
Subject: using jsf backing bean in non jsf jsp

I have a jsf page the brings up a non jsf jsp in both an iframe and as a
popup.
I want to use the jsf backing bean (consoleHandler below) in the jsp. I
used:
 
<%
   LifecycleFactory lFactory =
(LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
   Lifecycle lifecycle =
lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
   FacesContextFactory fcFactory =
(FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FA
CTORY);
   FacesContext facesContext =
fcFactory.getFacesContext(getServletContext(), request, response,
lifecycle);
   ConsoleHandler consoleHandler = 
 
(ConsoleHandler)facesContext.getApplication().getVariableResolver().resolveV
ariable(facesContext, "consoleHandler");
%>

This worked fine on my development machine, the same bean is used by the jsp
page,
but when I uploaded it to the production server, the jsp creates a new
instance of
the backing bean every time it is called (I put a println in the bean
constructor).
The code base is exactly the same. Any ideas why this would happen?

Thanks,
Lance



Reply via email to