[jboss-user] [JBoss Seam] - Problem outjecting a field

taprogge do-not-reply at jboss.com
Wed Sep 20 07:07:19 EDT 2006


Hi!

I have a problem here which I have been unable to solve...
I have here two statufel Seam session beans. One uses the DataModel and DataModelSelection mechanism to fetch some data rows. The other is used to edit an item from that list.
What I have done is this: I added a getter for the DataModelSelection field to the ListAction bean and a method to the EditAction bean that gets the field from the list action and stores it in it's own variable which is marked for outjection:


  | @Stateful
  | @Scope(SESSION)
  | @Name("listAction")
  | public class ListActionBean implements ListAction {
  | 
  | 	@DataModel
  | 	private List<Charge> chargeList;
  | 
  | 	@DataModelSelection
  | 	private Charge chargeItem;
  | 
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 
  | 	@Factory
  | 	public void getChargeList() {
  | 
  | 		chargeList = (List<Charge>) em.createQuery("FROM Charge c")
  | 			.getResultList();
  | 	}
  | 	
  | 	public String refreshList() {
  | 		getChargeList();
  | 		return Outcome.REDISPLAY;
  | 	}
  | 	
  | 	public Charge getChargeItem() {
  | 		return chargeItem;
  | 	}
  | 	
  | 	@Remove
  | 	@Destroy
  | 	public void destroy() {
  | 		// nothing to clean up here
  | 	}
  | }
  | 

  | @Stateful
  | @Conversational(ifNotBegunOutcome = "notbegun")
  | @Name("managementAction")
  | public class ManagementActionBean implements ManagementAction {
  | 
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 
  | 	@In(required = false)
  | 	@Out
  | 	private Charge chargeItem;
  | 
  | 	@In
  | 	private ChargeListAction chargeListAction;
  | 	
  | 	@In(create = true)
  | 	private Conversation conversation;
  | 
  | 	@Begin
  | 	public String editCharge() {
  | 		chargeItem = em.merge(chargeListAction.getChargeItem());
  | 		return "chargemanagement.detail";
  | 	}
  | 	
  | 	@End
  | 	public String back() {
  | 		return "chargemanagement.tolist";
  | 	}
  | 	
  | 	@Remove
  | 	@Destroy
  | 	public void destroy() {
  | 	}
  | }
  | 

Now the problem is that chargeItem is not correctly outjected in the ManagementAction Bean. By writing to stout, I have verified that in ManagementAction#editCharge() the variable is correctly initialized with the selected charge from the ListAction.
But neither will a jsp display values from that charge nor will ManagementAction#back() work, complaining thusly:


  | Out attribute requires value for component: chargeManagementAction.chargeItem
  | 

What the heck am I missing here?

Thanks a lot,

Phil

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

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



More information about the jboss-user mailing list