1
The question is this... although the problem does not involve JPA/ORM I find it interesting to contextualize.
My little project has a @Entity Addressee and as the name suggests it is an entity responsible for storing data related to real estate addresses, in this way, several other entities make relationships with this first one, such as the Client class and the Publisher class, etc... (For a publisher has a real address, as well as a client)
I thought then that maybe it would be possible to create a kind of VIEW in JSF called "view-addressee.xhtml" and it would contain all inputs that feed an entity of the address type, so I could give a INCLUDE in that view and load itthere wherever it is necessary to fill out address book.
But I entered a following dilemma...
Each JSF form is tied to a Managedbean, right? So, if I implement a publisher registration I will have :
- A @Entity Publishing house
- A @Managedbean Editorabean
- And a XHTML register-publisher.xhtml
My XHTML register-publisher.xhtml would give a include in the view responsible for addressee right?
And how then I would associate the attributes of the object editoraBean.editora.endereco to the VALUES of the JSF inputs of the "view-address.xhtml" ?
To illustrate, imagine a page like this:
<h:body>
<h:form prependId="false">
<p:growl id="msgs" showDetail="true" />
<p:fieldset id="basic" legend="Editora" style="margin-bottom:20px">
<h:panelGrid columns="2" cellpadding="10">
<p:outputLabel value="Nome: " for="txtEditora" />
<p:inputText id="txtEditora" value="#editoraBean.editora.nomeEditora}" />
</h:panelGrid>
</p:fieldset>
<ui:include src="/restricted/fragments/contato.xhtml" />
<ui:include src="/restricted/fragments/endereco.xhtml" />
</h:form>
</h:body>
Do you understand? After all, how do I intend to modularize this view I cannot associate the values of its inputs to editoraBean, but I would like to associate them even if it were transmitting the ENDERECO object via parameter to the view and then retrieving the values of the view to give Submit on the publisher page.