gpt4 book ai didi

java - 选择在扩展数据表、RichFaces 4 + JSF 2.0 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 08:28:19 24 4
gpt4 key购买 nike

我有一个带有 RichFaces 4.0.0.Final 和 JSF 2.0 的应用程序。当我尝试在扩展数据表中使用选择时,它不起作用。

<rich:extendedDataTable
id="shipmentList" value="#{shipmentListBean.shipmentList}" var="shipment"
rowClasses="#{shipment.paymentDate == null ? 'unpaidShipment' : null}"
selectionMode="single" noDataLabel="#{msgs.emptyList}"
selection="#{shipmentListBean.selection}"
style="width: 1200px; font-size: 10px; ">

ShipmentListBean:

@ManagedBean
@ApplicationScoped
public class ShipmentListBean implements Serializable {

private Collection<Object> selection = null;

public ShipmentListBean() {
}

public List<ShipmentValueObject> getShipmentList() {
....
}


public Collection<Object> getSelection() {
return selection;
}

public void setSelection(Collection<Object> selection) {
this.selection = selection;
}
}

为什么在方法 selSelection(Collection Selection) 中,当我选择表中的行时出现空集合?

最佳答案

您可以像这样使用选择

in ShipmentListBean 



private SimpleSelection selection = new SimpleSelection();

// now time to get a selected Row id from the extendedDataTable.
// this method you can call on any button after selecting the row from the extendedDataTable
public void selectedRecord(){
try{
Iterator<Object> iterator = getSelection().getKeys();

while(iterator.hasNext()){
// Here you will get all the selected roes id from the Data table
Object obj = iterator.next();

info("GET SELECTED ROWS ID ::::: " + obj.toString());

}
}catch(Exception e){
e.printStackTrace();
}
}

关于java - 选择在扩展数据表、RichFaces 4 + JSF 2.0 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8064278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com