开发者

DataModel and DataModelSelection in Seam3

I cannot seem to find where is @DataModel and @Data开发者_如何学运维ModelSelection in Seam3 (as opposed to Seam2). In what Seam module are they defined? If their name has been changed, what is it currently?


Assuming you are using JSF2.0, you can 'inject' selection to action methods like this:

<h:dataTable value="#{itemManager.itemList}" var="item">
   <h:column>
      <f:facet name="header">Item Id</f:facet>
      #{item.id}
   </h:column>
   <h:column>
      <f:facet name="header">Item Name</f:facet>
      #{item.name}
   </h:column>
   <h:column>
      <f:facet name="header">Action</f:facet>
      <h:commandLink value="Delete" action="#{itemManager.delete(item)}" />
   </h:column>
</h:dataTable>

and corresponding managed bean:

@ManagedBean(name="itemManager")
@SessionScoped
public class ItemManager {
    ArrayList<Item> itemList;

    public ArrayList<Item> getItemList() {
        if (itemList == null) {
            itemList = ... // build item list
        }
        return itemList;
    }

    public String delete(Item item) {
        itemList.remove(item);
        return null;
    }
}


@DataModel and @DataModelSelection feature is not available in Seam3.


I you use richfaces, you can use the following construct:

<a:commandLink value="Delete" action="#{bean.delete}">
  <f:setPropertyActionListener value="#{item}" target="#{bean.selectedItem}" />
</a:commandLink>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜