[jboss-user] [JBoss Seam] - [booking example]: question regarding the HotelBookingAction

ellenzhao do-not-reply at jboss.com
Thu Nov 23 06:26:08 EST 2006


The code in question:


  | @In(required=false) 
  | @Out(required=false)
  | private Booking booking;
  | 
  | 

I thought a booking without a Booking instance sounds weird, so that I removed the (required=false) for the @In annotation. But then got an org.jboss.seam.RequiredException. But in the RegisterAction.java, there is 


  | @In
  | private User user; 
  | 

And it works. I looked for the more precise explanation about the "required" attribute, but the documentation didn't answer my question: Required from what? Required for what? (I thought a Booking instance should be required for a booking action, logically. But it seems that it is "required" from the context.... I changed the annotation to @In (create = true) and it worked again, but I guess the created instance would soon be an orphan in the heap since there is this line:

  | booking = new Booking(hotel, user);
  | 
 
in the bookHotel() method. )

More changes I made to the code: after user login, the pageflow is managed by a jpdl file. 

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

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



More information about the jboss-user mailing list