[jboss-user] [JBoss Seam] - @unwrap that manages backing beans...

gagool do-not-reply at jboss.com
Wed Oct 31 07:57:22 EDT 2007


Hello, I would like to manage access to multiple instances of backing beans .

I would like something like this but working.


  | @Name("perCellForm")
  | public class PerCellFormBean implements PerCellForm {
  | 
  | 	HashMap<Long, FormAction> cells = new HashMap<Long, FormAction>(10);
  | 
  | 	@In
  | 	private Cell currentCell;
  | 
  | 	@Unwrap
  | 	public FreeAction getCell() {
  | 
  | 		if (cells.containsKey(currentCell.getId())) {
  | 			return cells.get(currentCell.getId());
  | 		} else {
  | 
  | 			Object component = Component.getInstance("FormAction", true);
  | 
  | 			cells.put(currentCell.getId(), (FormAction) component);
  | 			return (FormAction) component;
  | 		}
  | 	}
  | 
  | 	@Destroy
  | 	@Remove
  | 	public void remove() {
  | 
  | 	}
  | }
  | 

Object component = Component.getInstance("FormAction", true);
Obviously doesn't work since the component only will be created once and then just re-gotten from the conversation context.

Is it possible to do a manager such as this with seam?

I need to be able to dynamically assign multiple instances of stateful backing beans for forms.

I need seam to actually instantiate multiple instances and be able to hold references to them, how do I do that?



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

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



More information about the jboss-user mailing list