日期:2014-05-18 浏览次数:21190 次
@Entity @Table(name = "t_organization") public class Organization { private int id; private String name; private String sn;// private String description; private Organization parent; private Set<Organization> children = new HashSet<Organization>(); @Id @GeneratedValue public int getId() { return id; } public void setId(int id) { this.id = id; } @ManyToOne() @JoinColumn(name = "pid") public Organization getParent() { return parent; } public void setParent(Organization parent) { this.parent = parent; } @OneToMany(cascade=CascadeType.ALL,mappedBy = "parent") public Set<Organization> getChildren() { return children; } public void setChildren(Set<Organization> children) { this.children = children; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSn() { return sn; } public void setSn(String sn) { this.sn = sn; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
<s:iterator value="orgs"> <tr bgcolor="#EFF3F7" class="TableBody1" onmouseover="this.bgColor = '#DEE7FF';" onmouseout="this.bgColor='#EFF3F7';"> <td align="center" vAlign="middle"><s:property value="id"/></td> <td align="center" vAlign="middle"><s:property value="name"/></td> <td align="center" vAlign="middle"><s:property value="sn"/></td> <td align="center" vAlign="middle"><s:property value="parent.name"/></td> <td align="center" vAlign="middle"><a href="#" onclick="">删除</a></td> </tr> </s:iterator>