0

我正在使用 wicket 1.5.7,我想在 DefaultDataTable 的单元格中创建一个链接。
所以我复制了这个页面中的例子,但我从检票口得到运行时错误:

最后一个原因:找不到关联的标记文件。ActionPanel:[ActionPanel [组件 id = 单元]]

这是我的一些代码:

public GroupsList(final PageParameters parameters)
{
  ArrayList<IColumn> columns = new ArrayList<IColumn>();
  columns.add(new AbstractColumn<Group>(new Model<String>("Actions"))
    {
        public void populateItem(Item<ICellPopulator<Group>> cellItem, String componentId,
            IModel<Group> model)
        {
            cellItem.add(new ActionPanel(componentId, model));
        }
    });
    add(new DefaultDataTable("table", columns, new GroupDataProvider(), 8));
}

这是我的 ActionPanel

class ActionPanel extends Panel
{
    public ActionPanel(String id, IModel<Group> model)
    {
        super(id, model);
        add(new Link("select")
        {
            @Override
            public void onClick()
            {
                PageParameters pp = new PageParameters();
                setResponsePage(new HomePage(pp));
            }
        });
    }
}

任何想法的根本原因是什么?

4

1 回答 1

1

从错误消息来看,您缺少 ActionPanel.html。要么是命名错误,放错了地方,要么完全失踪了。随着面板的发展,他们需要他们的标记。在提到的示例的情况下,标记文件被“隐藏”为BasePage$ActionPanel.html,因为 ActionPanel 是 BasePage 的内部类。

于 2012-08-15T10:13:01.077 回答