Hi Folks!
i have the following scenario:
I have a page with a list of users called userList.xhtml and another page where
i want to edit the previosly selected user called user.xhtml.
The users shown in userList come from the @DataModel annotated benutzerList in
BenutzerManager, which is a SFSB.
The selected user shall be injected in BenutzerManager via the
@DataModelSelection annotation.
it seems that the user is not injected and thus not outjected to user.xhtml.
So my user.xhtml shows a blank record.
Interestingly, if i add a page action into pages.xml which does nothing but
call an empty void function on the BenutzerManager, the user is correctly
propagated.
Im out of ideas now.
Thanks for your help.
Tobias Kilian
This is BenutzerManager.java:
|
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("benutzerManager")
| public class BenutzerManagerImpl implements Serializable, BenutzerManager {
| private static final long serialVersionUID = -6318701843857711619L;
|
| @DataModelSelection
| @Out(required = false)
| private BenutzerImpl selectedBenutzer;
|
| @Logger
| private Log log;
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| public void selectBenutzer()
| {
| }
|
| @DataModel
| private List<Benutzer> benutzerList;
|
| @Factory("benutzerList")
| public void findBenutzer() {
| benutzerList = em.createQuery("from BenutzerImpl benutzer")
| .getResultList();
| }
| ...
| }
|
Here is my userList.xhtml:
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| template="layout/template.xhtml">
|
| <ui:define name="body">
| <h1>userList</h1>
| <h:messages styleClass="message"/>
| <h:outputText value="No benutzer exists"
| rendered="#{empty benutzerList}"/>
| <h:dataTable var="benutzerIterator" value="#{benutzerList}"
rendered="#{not empty benutzerList}">
| <h:column>
| <f:facet name="header">
| <h:outputText value="Id"/>
| </f:facet>
| <h:outputText value="#{benutzerIterator.id}"/>
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Name"/>
| </f:facet>
| <s:link view="/user.xhtml" value="#{benutzerIterator.name}"
propagation="join">
| </s:link>
| </h:column>
| </h:dataTable>
|
| <div class="actionButtons">
| <s:button id="done" value="Erstelle neuen Benutzer"
| view="/user.xhtml"/>
| </div>
|
| </ui:define>
| </ui:composition>
|
and here the user.xhtml:
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:tr="http://myfaces.apache.org/trinidad"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h1>Benutzer</h1>
| <h:messages globalOnly="false" styleClass="message"/>
|
| <h:form id="benutzerForm">
| <s:validateAll>
| <div class="dialog">
|
| <div class="prop">
| <span class="name">Name</span>
| <span class="value">
| <s:decorate>
| <s:message/>
| <h:inputText id="name" required="true"
| value="#{selectedBenutzer.name}"/>
| </s:decorate>
| </span>
| </div>
|
| <div class="prop">
| <span class="name">Gruppe</span>
| <span class="value">
| <s:decorate>
| <s:message/>
| <h:selectOneMenu
| id="selectGruppenAuswahl"
|
value="#{selectedBenutzer.gruppe}"
| required="true">
| <s:selectItems
id="gruppenAuswahl" value="#{alleGruppen}" var="gruppeItem"
label="#{gruppeItem.label}"/>
| <s:convertEntity />
| </h:selectOneMenu>
| </s:decorate>
| </span>
| </div>
| </div>
| </s:validateAll>
|
| <div class="actionButtons">
| <h:commandButton value="Save" id="saveButton"
action="#{benutzerManager.save}"/>
| <h:commandButton value="Delete" id="deleteButton"
action="#{benutzerManager.delete}"/>
| <s:button value="Cancel" id="cancelButton"
view="/userList.xhtml" action="#{benutzerManager.cancel}"/>
| </div>
| </h:form>
|
| </ui:define>
|
| </ui:composition>
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040548#4040548
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040548
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user