Tapestry 和 Wicket 的比较
2010-03-30 00:00:00 来源:WEB开发网清单 10. Tapestry Java 类
public abstract List getReceivedItems();
public abstract void setReceivedItems(List items);
public abstract ActionItem getCurrentItem();
清单 11. Tapestry HTML 标记
<tr jwcid="receivedItems">
<td><span jwcid="itemId">ID</span></td>
<td><span jwcid="subject">Subject</span></td>
<td><span jwcid="creator">Creator</span></td>
<td><span jwcid="recipient">Recipient</span></td>
</tr>
在 Wicket 中,我们采用 ListView 类并匿名地实现其 populateItem() 方法,如清单 12、13 所示:
清单 12. Wicket Java 类
add(new ListView("receivedItems", items) {
protected void populateItem(final ListItem item) {
ActionItem todo = (ActionItem) item.getModelObject();
item.add(new Label("itemId", String.valueOf(todo.getItemId()));
item.add(new Label("subject", todo.getSubject()));
item.add(new Label("creator", todo.getCreator()));
item.add(new Label("recipient", todo.getRecipient()));
}
});
清单 13. Wicket HTML 标记
<tr wicket:id="receivedItems">
<td><span wicket:id="itemId">ID</span></a></td>
<td><span wicket:id="subject">Subject</span></td>
<td><span wicket:id="creator">Creator</span></td>
<td><span wicket:id="recipient">Recipient</span></td>
</tr>
更多精彩
赞助商链接