Nested Display Tag Tables

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Nested Display Tag Tables

Ahmad-13
Hi,
 
I need to use the nested table option for display tags. Below is the current code/setup which does not throw any errors but only displays the parent table or the main table data but not the nested one.
 
Not sure what I am missing...I am using DisplayTag 1.2.
 
 
 
I have an object with a nested collection (One to many relation within the same table - An asset can be child of another asset).

 

Here is my displaytag code

 

 <display:table name="assetList" id="parent" requestURI="/listAssets" pagesize="10" >
  <display:column property="assetAddress" title="assetAddress"  />
  <display:column property="assetVersion" title="assetVersion"/>
  <display:column property="comments" title="Comments" />

   <display:table name="${parent.assetsCollection}" id="ad">
  <display:column property="assetAddress"/>
  <display:column property="assetVersion" />
    <display:column property="comments" title="Comments" />
 </display:table>
 
</display:table>

 

 

Here is the entity class code:

-------------------------------------------------------------------------------------

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.vulmgr.actions.db;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "ASSETS")
@NamedQueries({
    @NamedQuery(name = "Assets.findAll", query = "SELECT a FROM Assets a"),
    @NamedQuery(name = "Assets.findByAssetId", query = "SELECT a FROM Assets a WHERE a.assetId = :assetId"),
    @NamedQuery(name = "Assets.findByAssetAddress", query = "SELECT a FROM Assets a WHERE a.assetAddress = :assetAddress"),
    @NamedQuery(name = "Assets.findByAssetVersion", query = "SELECT a FROM Assets a WHERE a.assetVersion = :assetVersion"),
    @NamedQuery(name = "Assets.findByComments", query = "SELECT a FROM Assets a WHERE a.comments = :comments")})
public class Assets implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(generator="ASSET_SEQ")
    @SequenceGenerator(name="ASSET_SEQ", sequenceName="ASSET_SEQ", allocationSize=1)
    @Basic(optional = false)
    @Column(name = "ASSET_ID")
    private BigDecimal assetId;
    @OneToMany(mappedBy = "assets")
    private Collection<Assets> assetsCollection;
    @JoinColumn(name = "PARENT_ASSET", referencedColumnName = "ASSET_ID")
    @ManyToOne
    private Assets assets;

    public Assets() {
    }

    public Assets(BigDecimal assetId) {
        this.assetId = assetId;
    }

    public Assets(BigDecimal assetId, String assetAddress, String assetVersion) {
        this.assetId = assetId;
    }

    public BigDecimal getAssetId() {
        return assetId;
    }

    public void setAssetId(BigDecimal assetId) {
        this.assetId = assetId;
    }

 


    public Collection<Assets> getAssetsCollection() {
        return assetsCollection;
    }

    public void setAssetsCollection(Collection<Assets> assetsCollection) {
        this.assetsCollection = assetsCollection;
    }

    public Assets getAssets() {
        return assets;
    }

    public void setAssets(Assets assets) {
        this.assets = assets;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (assetId != null ? assetId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Assets)) {
            return false;
        }
        Assets other = (Assets) object;
        if ((this.assetId == null && other.assetId != null) || (this.assetId != null && !this.assetId.equals(other.assetId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.vulmgr.actions.db.Assets[assetId=" + assetId + "]";
    }

}

--
------------------------------------
http://www.operationbadar.net


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
displaytag-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user