Thanks posted http://www.seamframework.org/Community/BeanCreatedTwice

-Arun

On 7/22/10 3:35 PM, Pete Muir wrote:
> Hi Arun
>
> Please post on the forum at http://www.seamframework.org/Community/WeldUsers 
> - this list for development discussions.
>
> Thanks
>
> On 22 Jul 2010, at 19:26, Arun Gupta wrote:
>
>> For the attached simple application (WAR and source), accessing 
>> http://localhost:8080/HelloConversation/faces/index.xhtml creates 
>> ShoppingCart twice. Any idea ?
>>
>> Utility class is ...
>>
>> @Named("util")
>> @ConversationScoped
>> public class ConvUtil implements Serializable {
>>      @Inject ShoppingCart cart;
>>
>>      public ShoppingCart getCart() {
>>          return cart;
>>      }
>> }
>>
>> index.xhtml has ...
>>                  <h:inputText value="#{util.cart}" title="name" id="name"
>>                               required="true" />
>>
>>
>> ShoppingCart is ...
>>
>> @Named
>> @ConversationScoped
>> public class ShoppingCart implements Serializable {
>>      public ShoppingCart() {
>>          System.out.println("Creating shopping cart ..." + 
>> Calendar.getInstance().get(Calendar.MILLISECOND));
>>      }
>>
>> }
>>
>> At least the log messages like:
>>
>> INFO: Creating shopping cart ...264
>> INFO: Creating shopping cart ...265
>>
>> are printed.
>>
>> Tried changing the scope of ShoppingCart to RequestScoped but still the 
>> same. Changed @Named to @javax.faces.bean.ManagedBean on ShoppingCart.
>>
>> What am I not doing correctly ?
>>
>> -Arun
>> --
>> Blog: http://blogs.sun.com/arungupta
>> Twitter: http://twitter.com/arungupta
>>
>> <HelloConversation.zip><HelloConversation.war>_______________________________________________
>> weld-dev mailing list
>> [email protected]
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>

-- 
Blog: http://blogs.sun.com/arungupta
Twitter: http://twitter.com/arungupta
_______________________________________________
weld-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-dev

Reply via email to