[jboss-user] [JBoss Seam] - Howto: acces from bean to another SFSB?

Stateless Bean do-not-reply at jboss.com
Tue Jun 26 11:19:53 EDT 2007


hi,
I have authenticator method, and afterr successfull login user is redirected to second page.
On second page some values are getted from bean "gameAction" (SFSB).

I thought that to create this SFSB in authenticator bean and set this values and inject this bean to session.

Here I found an example how to access to bean from another bean.

  | Map session = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
  | 					    GameAction backBean = (GameAction)session.get("gameAction");
  | 
when user first time login my GameAction bean is always null so, i check this and create my new bean.


  | 	if (backBean == null) {
  | 		backBean = new GameAction(Long id, String name);
  | 		backBean.setPlanetName("Earth");
  | 		session.put("gameAction", backBean);
  | 	}
  | 

and on my page i get planetName like <h:output....

Is this right idea? or maybe is better way to create new bean and set fields?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057756#4057756

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057756



More information about the jboss-user mailing list