Getting access to other Baked Beans

Hi,

I have problems with getting access from a Baked Bean to a second one.

This is how I try to get it:

final FacesContext context = FacesContext.getCurrentInstance();

final HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();

final HttpSession session = request.getSession();

final WarenkorbBean wk = (WarenkorbBean) session.getAttribute("warenkorb");

Unfortunately, wk has always the value NULL.

"warenkorb" is the name of the Bean which I try to get access to. The "warenkorb" - Bean itself works, I can access it via <h:outputText> for example. But I need it in another Bean.

Here is my declaration in the config file:

<managed-bean>

<managed-bean-name>warenkorb</managed-bean-name>

<managed-bean-class>de.bau.warenkorbverwaltung.ui.WarenkorbBean</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

Do you have any idea what I forgot?

Thanks in advance!

[1246 byte] By [dozer123a] at [2007-11-27 6:18:30]
# 1
I had the same problem. Have a look here for the solution: http://forum.java.sun.com/thread.jspa?forumID=427&threadID=5178067
mwinandya at 2007-7-12 17:32:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Backing beans are stored in the ExternalContext, not in the HttpSession.See http://balusc.xs4all.nl/srv/dev-jep-com.html for several ways to access/communicate with other backing beans.
BalusCa at 2007-7-12 17:32:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thanks to both of you, that did the trick!
dozer123a at 2007-7-12 17:32:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...