Re: ViewScoped bean created multiple times?

2014-11-08 Thread Ludovic Pénet
I would rather use @Named / @Inject, which are more powerful than @ManagedBean / @ManagedProperty. You can inject more stuff, in more places with less side effects. You would have less side effects with properties serialization and such things. I also usually prefer Deltaspike

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
But if a bean can be constructed multiple times, won't @PostConstruct also be called multiple times or am I misunderstanding the way @PostConstruct works? Also PriceController is ApplicationScoped, shouldn't it be ok to use @ManagedProperty? But I did a try using Weld and CDI but I got the same

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
Yes, I tried using Weld and CDI but with the same result. Also I do not do bean init stuff in the consctructor but in a init-method that I am trying to make sure is called only once, which do not seem to be that easy. BTJ On Sat, 08 Nov 2014 13:13:35 +0100 Ludovic Pénet l.pe...@senat.fr

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Ludovic Pénet
Having an init method called once at the beginning is the purpose of @PostConstruct. I may not use the right words, but the @PostConstruct method will be called only once, when the bean is instantiated, even if navigation triggers serialization and multiple objects are instantiated. It will

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
Ok, but I have tried using @PostConstruct also and it is called as many times as the constructor :-| BTJ On Sat, 08 Nov 2014 13:41:49 +0100 Ludovic Pénet l.pe...@senat.fr wrote: Having an init method called once at the beginning is the purpose of @PostConstruct. I may not use the

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Ludovic Pénet
Can you give us some kind of minimal, mavenised project so that we can see ? Ludovic Le 8 novembre 2014 14:00:22 UTC+01:00, Bjørn T Johansen b...@havleik.no a écrit : Ok, but I have tried using @PostConstruct also and it is called as many times as the constructor :-| BTJ On Sat, 08 Nov

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
Not mavenised but gradlenised... :) Can be download from here..: http://www.havleik.no/KBNJulekalender.tar.gz This is just a project I quickly created to show which numbers have won in a Christmas calendar BTJ On Sat, 08 Nov 2014 14:06:16 +0100 Ludovic Pénet l.pe...@senat.fr wrote:

Re: ViewScoped bean created multiple times?

2014-11-08 Thread PÉNET LUDOVIC
Bjørn T Johansen a écrit : Not mavenised but gradlenised... :) Can be download from here..: http://www.havleik.no/KBNJulekalender.tar.gz This is just a project I quickly created to show which numbers have won in a Christmas calendar I think your problem is that you are mixing a

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
Ahhh, yes Did not know that... Thx! :D BTJ On Sun, 9 Nov 2014 00:00:19 +0100 PÉNET LUDOVIC l.pe...@senat.fr wrote: Bjørn T Johansen a écrit : Not mavenised but gradlenised... :) Can be download from here..: http://www.havleik.no/KBNJulekalender.tar.gz This is just a project I

Re: ViewScoped bean created multiple times?

2014-11-08 Thread PÉNET LUDOVIC
PÉNET LUDOVIC a écrit : Bjørn T Johansen a écrit : Not mavenised but gradlenised... :) Can be download from here..: http://www.havleik.no/KBNJulekalender.tar.gz This is just a project I quickly created to show which numbers have won in a Christmas calendar I think your problem is

Re: ViewScoped bean created multiple times?

2014-11-08 Thread Bjørn T Johansen
Ok, thx... :) I thought that since I was not doing anything else than displaying information, the h:form was not needed but guess I was wrong... :-| And the a class=navbar-brand href=#KBN Julekalender 2014/a is just there to get a header, it is not really a link... :) This is my first

ViewScoped bean created multiple times?

2014-11-07 Thread Bjørn T Johansen
I trying to create a webapplication using request and/or viewscope instead of sessionscope, which I have always used... (Neved needed to concern myself with memory usage in the apps I have implemented.. :) ) But I now have a problem using @ViewScoped.. When I access index.xhtml which uses a

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Kito Mann
Hello Bjorn, Do you have component bindings in your page (i.e h:myComponent binding=#{myBean.comp}/)? That causes the exact behavior you're describing in versions of JSF prior to 2.2. What version of MyFaces are you using? ___ Kito D. Mann | @kito99 | Author, JSF in Action Virtua, Inc. |

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Howard W. Smith, Jr.
Interesting, you asked the same question in PrimeFaces forum. http://forum.primefaces.org/viewtopic.php?f=3t=40267 On Fri, Nov 7, 2014 at 3:42 PM, Bjørn T Johansen b...@havleik.no wrote: I trying to create a webapplication using request and/or viewscope instead of sessionscope, which I have

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Bjørn T Johansen
No bindings... And using Myfaces 2.2.5 BTJ On Fri, 7 Nov 2014 15:57:00 -0500 Kito Mann kito.m...@virtua.com wrote: Hello Bjorn, Do you have component bindings in your page (i.e h:myComponent binding=#{myBean.comp}/)? That causes the exact behavior you're describing in versions of JSF

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Bjørn T Johansen
Yes, I did.. But since I did not get any answer there and I thought that this was more a JSF question than a PrimeFaces question, I thought I should try here Was that wrong? BTJ On Fri, 7 Nov 2014 15:58:59 -0500 Howard W. Smith, Jr. smithh032...@gmail.com wrote: Interesting, you asked the

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Howard W. Smith, Jr.
That's fine. Can you provide your XHTML and java bean definition (source code) here? You provided a little bit of your java bean in primefaces forum. Your XHTML and java bean may help us on this list to help you. On Fri, Nov 7, 2014 at 4:11 PM, Bjørn T Johansen b...@havleik.no wrote: Yes, I

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Bjørn T Johansen
That I can do... :) Attached... BTJ On Fri, 7 Nov 2014 16:14:55 -0500 Howard W. Smith, Jr. smithh032...@gmail.com wrote: That's fine. Can you provide your XHTML and java bean definition (source code) here? You provided a little bit of your java bean in primefaces forum. Your XHTML and

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Kito Mann
OK. What version do you have in your faces-config.xml file? Also, do you have javax.faces.PARTIAL_STATE_SAVING set to false in web.xml? ___ Kito D. Mann | @kito99 | Author, JSF in Action Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting http://www.JSFCentral.com |

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Bjørn T Johansen
2.2, like this.: faces-config xmlns=http://xmlns.jcp.org/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd; version=2.2 No,

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Thomas Andraschko
Constructor is called multiple times by design - thats how object serialization works. Serislization is enabled by default in myfaces to support clustering/failover. No clue about viewaction - i cant use jsf 2.2. Am Freitag, 7. November 2014 schrieb Bjørn T Johansen : 2.2, like this.:

Re: ViewScoped bean created multiple times?

2014-11-07 Thread Leonardo Uribe
Hi In my opinion, you should use @PostConstruct annotation over init method. But the code has an entry like this: @ManagedProperty(value=#{priceController}) private PriceController priceController; Since this is inside a view scope bean, PriceController instance is saved with the view