-2

我正在使用 Struts 2.3.7、struts2-jquery-grid-plugin-3.5.0 和休眠 3.6。我正在使用一对多映射来连接两个实体。这些实体

问题.java

    public class Issue implements Serializable
    {
    private Integer issue_id;
    private String  issue_description;
    private Date issue_raised_date;
    private Set<Issue_Tracker> issueTracker = new HashSet<Issue_Tracker>(0);

getter and setters

Issue_Tracker.java

public class Issue_Tracker implements Serializable
{  
     private Integer issue_id;
     private String assignedTo;

如何在 assignmentTo 列的 jqgrid 中显示此数据。我的 jqgrid 如下:

<sjg:grid
    id="gridtable"
    caption="Issue-Summary"
    dataType="json"
    href="%{remoteurl}"
    pager="true"
    gridModel="gridModel"
    rowList="10,15,20"
    rowNum="15"
    rownumbers="true"
    reloadTopics="reloadGrid"
>
    <sjg:gridColumn name="issue_id"  id="issueId"  index="id" title="Issue-ID" formatter="integer"  sortable="false"/>
    <sjg:gridColumn name="issue_description" index="id" title="Issue-Details"  sortable="false"/>
    <sjg:gridColumn name="issue_raised_date" index="date" title="Issue-Date"  formatter="date"  sortable="false"/>

    <sjg:gridColumn name="issueTracker"  index="assigned" title="Assigned To"  sortable="false"/>
</sjg:grid>

但输出如下, 在此处输入图像描述

如何在assignmentTo列中显示实际数据而不是此对象。

4

1 回答 1

0

假设assignedTo不是多个

尝试这个

改变

 private Set<Issue_Tracker> issueTracker = new HashSet<Issue_Tracker>(0);

  public  IssueTracker issueTracker;

在你的jsp页面中

改变

 <sjg:gridColumn name="issueTracker"  index="assigned" title="Assigned To"  sortable="false"/>

 <sjg:gridColumn name="issueTracker.assignedTo"  index="issueTracker.assigned" title="Assigned To"  sortable="false"/>
于 2013-01-09T09:13:43.640 回答