How to init beans from other beans?

Hi,

I have got one authenticBean that checks if the user who try to login has the right name & pw. If this success this authenticBean creates a playerMainBean (session) with the userID. (Thats my simple user login/logout solution *g*).

I publish my userID to the playerMainBean like this:

public java.lang.String login(){

FacesContext context = FacesContext.getCurrentInstance();

//create Value Binding to PersonalMainBean and sets the unique-DB-id

//(constructor init valuesWebUtilBean to manipulate the rightSide-View

PlayerMainBean tempPlayerBean = (PlayerMainBean)context.getApplication().createValueBinding("#{playerMainBean}").getValue(context);

//set ID and fill Bean with Data

tempPlayerBean.setUniqueID(UserStates.getUserID(login, password));

tempPlayerBean.fillBean();

<--new Code !!-->

return"success";

}

I publish the userID for the playerMainBean with the tempBean.setUserID(int userID) but now I have to make the userID public to several other Beans. Should I init all other beans like the playerMainBean or is it possible to make the userID make public to all "session-beans" at once?

Cu

Alex

[1516 byte] By [Troilusa] at [2007-11-26 22:50:45]
# 1
Put it in the HttpSession or the SessionMap which is just accessible by the FacesContext.
BalusCa at 2007-7-10 12:12:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...