Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

SEAM- Need to understand the @factory

Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have an xhtml page which displays a list, this list is built by a factory in a stateless session bean. when the pages is demanded for the first request, the factory method is called and the list is well displayed. after the page is rendered, when we do a sbmitt on this page, the first thing done by the seam life cycle is to call this factory again, and before calling the apply request values values.
I know very well that my factory variable is destroyed after the response is sent because my component scope is EVENT.
As i understand from the lifecycle of JSF, the life cycle must update the model values of the form and after invoke the application, so why the factory is called before to instansiate the backing bean of the model.
my factory variable is needed only to render the response, so why it is instansieted?
I debug my code, i put a message in the constructor of Project(my baking bean for rthe form), and a message in the factory method, when the request is get(first request), the backing bean is first instansieted and after the factory is called.
but after a submit, i see that the factory is called and after the backingbean is instansieted to update model.
why? is the resoreView that calls the factory?

To understand me better, this is my xhtml page :

<h:inputText value="#{projet.nom}" size="15" required="true"/>
<br />
<h:inputText value="#{projet.description}" size="15" required="true"/>
<br />
<h:commandButton type="submit" value="creer Projet"
action="#{projetManager.ajouterProjet}" />
<h:dataTable value="#{projets}" var="project">
< h : outputText value="#{project.nom}" />
< h : outputText value="#{project.description}" />
after a submit, the factory is called first thing, because i think that my variable #{projets} is only needed to render the response.
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!