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 <[email protected]> wrote: > 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" <[email protected]> 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 2014 13:41:49 +0100 > >Ludovic Pénet <[email protected]> wrote: > > > >> 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 work this way independently of using @ManagedBean or @Named. > >> > >> I bumped my head in walls and trees when I had exactly your > >problem... :) > >> > >> @+! > >> > >> Le 8 novembre 2014 13:21:08 UTC+01:00, "Bjørn T Johansen" > ><[email protected]> a écrit : > >> >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 <[email protected]> wrote: > >> > > >> >> 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 @ViewAccessScoped to @ViewScope. > >> >With @ViewAccessScoped, your bean will live as long as it is used > >> >during user navigation. I find it more handier than @ViewScoped and > >> >even @FlowScoped, as it requires no configuration. > >> >> > >> >> Finally, I stopped doing bean init stuff in constructors. Objects > >are > >> >instantiated during serialization. I prefer to use @PostConstruct > >for > >> >init and @PreDestroy for termination stuff. > >> >> > >> >> Hope this helps. > >> >> > >> >> Ludovic > >> >> > >> >> Le 7 novembre 2014 22:22:07 UTC+01:00, "Bjørn T Johansen" > >> ><[email protected]> a écrit : > >> >> >That I can do... :) > >> >> > > >> >> >Attached... > >> >> > > >> >> > > >> >> >BTJ > >> >> > > >> >> >On Fri, 7 Nov 2014 16:14:55 -0500 > >> >> >"Howard W. Smith, Jr." <[email protected]> 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 java bean may help us on this list to help you. > >> >> >> > >> >> >> > >> >> >> On Fri, Nov 7, 2014 at 4:11 PM, Bjørn T Johansen > ><[email protected]> > >> >> >wrote: > >> >> >> > >> >> >> > 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." <[email protected]> wrote: > >> >> >> > > >> >> >> > > Interesting, you asked the same question in PrimeFaces > >forum. > >> >> >> > > > >> >> >> > > http://forum.primefaces.org/viewtopic.php?f=3&t=40267 > >> >> >> > > > >> >> >> > > > >> >> >> > > On Fri, Nov 7, 2014 at 3:42 PM, Bjørn T Johansen > >> ><[email protected]> > >> >> >wrote: > >> >> >> > > > >> >> >> > > > 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 managed bean in > >> >> >viewscope, the > >> >> >> > > > constructor is called multiple times. And the same with > >an > >> >init > >> >> >> > method, that > >> >> >> > > > should be called only once. I am using..: > >> >> >> > > > > >> >> >> > > > <f:metadata> > >> >> >> > > > <f:viewAction > >action="#{calendarController.initPrices}" > >> >/> > >> >> >> > > > </f:metadata> > >> >> >> > > > > >> >> >> > > > <h:head>...... > >> >> >> > > > > >> >> >> > > > to call the init method, but I have also tried using > >f:event > >> >> >> > prerenderView > >> >> >> > > > and also @PostConstruct but I am not able to make the > >bean > >> >call > >> >> >the > >> >> >> > init > >> >> >> > > > method only once... > >> >> >> > > > > >> >> >> > > > What am I missing? > >> >> >> > > > > >> >> >> > > > > >> >> >> > > > Regards, > >> >> >> > > > > >> >> >> > > > BTJ > >> >> >> > > > -- > >> >> >> > > > > >> >> >> > > > > >> >> >> > > >> >> > >> > >>>----------------------------------------------------------------------------------------------- > >> >> >> > > > Bjørn T Johansen > >> >> >> > > > > >> >> >> > > > [email protected] > >> >> >> > > > > >> >> >> > > > > >> >> >> > > >> >> > >> > >>>----------------------------------------------------------------------------------------------- > >> >> >> > > > Someone wrote: > >> >> >> > > > "I understand that if you play a Windows CD backwards you > >> >hear > >> >> >strange > >> >> >> > > > Satanic messages" > >> >> >> > > > To which someone replied: > >> >> >> > > > "It's even worse than that; play it forwards and it > >installs > >> >> >Windows" > >> >> >> > > > > >> >> >> > > > > >> >> >> > > >> >> > >> > >>>----------------------------------------------------------------------------------------------- > >> >> >> > > > > >> >> >> > > >> >> >> > > >>

