[webbeans-dev] where outjection paid its dues

Dan Allen dan.j.allen at gmail.com
Thu Apr 23 18:10:53 EDT 2009


I quickly discovered how I've taken outjection for granted when I got
started with the booking example. I instinctively created a @Producer
methods to expose the hotels to the UI

<h:dataTable value="#{hotels}" var="_hotel">...</h:dataTable.

   public
   @Produces
   @Named
   @RequestScoped
   List<Hotel> getHotels()
   {
      return hotels;
   }

However, the problem is that before the find() action gets a chance to
invoke in response to the user clicking the Search button, JSF has already
called on the "hotels" context variable and it is assigned to the request
scope. So the UI doesn't see the updated value of the hotels property in the
Render Response phase. If this method is on a session-scoped bean, you can
perform a redirect after post and then the UI will get the right value.

What's the cleanest way to clear the context varaible in the find() method
so that the producer runs again in the Render Response phase?

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20090423/bf542725/attachment.html 


More information about the weld-dev mailing list