[jboss-user] [JBoss Seam] - Re: How can I pass parameters to action methods

cupdike do-not-reply at jboss.com
Wed Sep 26 10:07:19 EDT 2007


"christian.bauer at jboss.com" wrote : So you need to find another way to pass an "object" from request to request. One way is to pass its identifier and to load it from the database in the second request. Another is to stick it into the session an retrieve it from there by identifier.
But the booking app does pass the object as a parameter [from main.xhtml]:

<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
  | ...
  |      <s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>

The only reason I can guess why this works is that the hotels DataModel property is outjected from a session-scoped SFSB.  However, I read in one of Dan Allen's articles on IBM that anonymous wrote : Outjected variables are placed directly into the variable context, independent of their backing bean.
So this suggests that it shouldn't matter.

Continuing...
"christian.bauer at jboss.com" wrote : And the last and best way is to put it into the conversation context in the first request, name the context variable in the action method as a parameter, and let Seam look it up from the conversation context in the second request. This is really what Seam is about.

Doesn't it depend on what the bounds of the conversation are? According to the Yuan/Heute book, anonymous wrote : The default conversation scope spans only two pages
However, I find this statement a bit misleading.  If you read further, it suggests that is really a single request/response cycle.  And wouldn't this then explain why trying to pass the object using default conversation scope doesn't work?  But then how does it work in the booking app, unless the scope of the component outjecting the property has some influence on the lifecycle of the outjected property.

Clearly I'm missing something I need to know about how all this works.  Please someone explain.

TIA, Clark

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

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



More information about the jboss-user mailing list