[jboss-user] [JBoss Seam] - Re: Loosing information right out of my entity bean....

g00se24 do-not-reply at jboss.com
Tue Jun 19 05:20:22 EDT 2007


Here we go:

PS: I'm using a4j extremly hard!!!


  | /**
  |  *
  |  * @author Dennis Guse
  |  *
  |  */
  | @Name("users")
  | @Scope(ScopeType.SESSION)
  | public class UserControl  extends Selection implements Serializable {
  |     
  |     @Out(required=false)
  |     public User getSelectedUser() {
  |         User selected = ((User) super.getSelected());
  |         if (selected != null) {
  |             System.out.println(selected.toString());
  |         }
  |         return (User) super.getSelected();
  |     }
  |     
  |     @In(required=false)
  |     public void setSelectedUser(User user) {
  |         setSelected(user);
  |     }
  |     
  |     public void add() {
  |         setSelected(new User());
  |     }
  |     
  |     public List<User> getResult() {
  |         return entityManager.createQuery(getQuery()).getResultList();
  |     }
  | }
  | 
  | <table 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:rich="http://richfaces.ajax4jsf.org/rich"
  |        xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
  |     <tr>
  |         <td>
  |             <h:outputLabel for="client">Client</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="client" value="#{selectedUser.client}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="status">Status</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="status" value="#{selectedUser.status}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="customerGroup">CustomerGroup</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="customerGroup" value="#{selectedUser.customerGroup}" />
  |         </td>
  |     </tr>
  | 
  |     <tr>
  |         <td>
  |             <h:outputLabel for="title">Titel</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="title" value="#{selectedUser.title}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="firstName">firstName</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="firstName" value="#{selectedUser.firstName}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="surName">surName</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="surName" value="#{selectedUser.surName}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="language">Language</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="language" value="#{selectedUser.language}" />
  |         </td>
  |     </tr>
  |     <tr>
  |         <td>
  |             <h:outputLabel for="username">userName</h:outputLabel>
  |         </td>
  |         <td>
  |             <h:outputText id="username" value="#{selectedUser.username}" />    
  |         </td>
  |     </tr>
  |     <tr>
  |         <table>
  |             <tr>
  |                 <td>
  |                     <h:outputLabel for="street">Street</h:outputLabel>
  |                 </td>
  |                 <td>
  |                     <h:outputText id="street" value="#{selectedUser.address.street}" />
  |                 </td>
  |             </tr>
  |             <tr>
  |                 <td>
  |                     <h:outputLabel for="address">StreetNumber</h:outputLabel>
  |                 </td>
  |                 <td>
  |                     <h:outputText id="address" value="#{selectedUser.address.streetNumber}" />
  |                 </td>
  |             </tr>
  |             <tr>
  |                 <td>
  |                     <h:outputLabel for="zip">ZIP</h:outputLabel>
  |                 </td>
  |                 <td>
  |                     <h:outputText id="zip" value="#{selectedUser.address.zip}" />
  |                 </td>
  |                 
  |             </tr>
  |             <tr>
  |                 <td>
  |                     <h:outputLabel for="town">Town</h:outputLabel>
  |                 </td>
  |                 <td>
  |                     <h:outputText id="town" value="#{selectedUser.address.town}" />
  |                 </td>
  |             </tr>
  |             <tr>
  |                 <td>
  |                     <h:outputLabel for="country">Country</h:outputLabel>
  |                 </td>
  |                 <td>
  |                     <h:outputText id="country" value="#{selectedUser.address.country}" />
  |                 </td>
  |             </tr>
  |         </table>
  |     </tr>
  | </table>
  | 
  | <!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:rich="http://richfaces.ajax4jsf.org/rich"
  |                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
  |                 template="/administration/template.xhtml">
  |     
  |     <ui:define name="control">
  |         <a4j:commandLink value="Add" action="#{users.add}" oncomplete="javascript:Richfaces.showModalPanel('user',{width:450, top:200})" reRender="selected, user" />
  |         <h:inputText id="input" value="#{users.search}">
  |             <a4j:support event="onkeyup" reRender="result" requestDelay="100" ajaxSingle="true" />
  |         </h:inputText>
  |     </ui:define>
  |     
  |     <ui:define name="result">
  |         <rich:dataTable id="table" value="#{users.result}" var="item">
  |             <h:column>
  |                 <h:outputText value="#{item.title} #{item.firstName} #{item.surName}">
  |                     <a4j:support event="onclick" action="#{users.select}" reRender="selected, user" />
  |                 </h:outputText>
  |             </h:column>
  |             <h:column>
  |                 <h:outputText value="#{item.status}" />
  |             </h:column>							
  |             <h:column>
  |                 <a4j:commandButton value="Delete" action="#{users.delete}" reRender="selected, result, user" />
  |             </h:column>							
  |         </rich:dataTable>
  |     </ui:define>
  |     
  |     <ui:define name="selected">
  |         <rich:tabPanel switchType="ajax" rendered="#{selectedUser != null}">
  |             
  |             <rich:tab label="Data">
  |                 <a href="javascript:Richfaces.showModalPanel('user',{width:450, top:200})">
  |                     Edit
  |                 </a>
  |                 <ui:include src="/objects/user.xhtml" />
  |             </rich:tab>
  |             
  |             <rich:tab label="Subscription">
  |                 <h:dataTable value="#{selectedUser.subscriptions}" var="item" rendered="#{selectedUser.subscriptions != null}">
  |                     <rich:column>
  |                         <h:outputText value="#{item}" />
  |                     </rich:column>
  |                 </h:dataTable>
  |             </rich:tab>
  |             
  |             <rich:tab label="SubChannels">
  |                 
  |                 <ui:include src="/objects/subchannels.xhtml"/>
  |                 
  |             </rich:tab>
  |             
  |         </rich:tabPanel>
  |         
  |     </ui:define>
  |     
  | </ui:composition>
  | 
  | The template for this page is easy nothing special, only some panels...
  | 

If i visit the /objects/user.xhtml direct, i can watch closely.
If a user gets selected I can see all attributes, but If I do any action on the page I lose the data, but only the data for the manytoone relations...

Thanks in advance!!!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055513#4055513

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055513



More information about the jboss-user mailing list