开发者

Icefaces Actionlistener Pass Parameter To Another Page

I have have icefaces datatable and when user clicks a row, I would like to pass that row's value to another page. The value could row's one column which is the primary key. I am planning to use

How can I do this?

Thanks

*Follow up**

Kindly suggest the approach I am following is the right for passing paramter from my icefaces datatable to another page.

I have the following in jsf page

<h:commandLink actionListener="#{bean.setSelectedItem}">

And in my bean of setSelectedItem(ActionEvent event) method I have the following code

 selectedRows.put(dataTable.getRowIndex(), true);  
 (selectedRows is of Map<Integer, Boolean> selectedRows = new HashMap<Integer, Boolean>();
 List<class> selectItems = new ArrayList<class>();
             for (int index = 0; index < dataList.size(); index++) {                
                if (isSelectedRow(index)) {
                    selectItems.add(dataList.ge开发者_StackOverflowt(index));
                }
            }
            newbean.method(selectItems);
            selectItems.clear();
            selectedRows.clear();

Correct me if I am doing anthing wrong above.

Thanks


Either bind the table component with UIData property in backing bean

<h:dataTable binding="#{bean.table}">

with

private UIData table;

or bind the table value with DataModel property in backing bean

<h:dataTable value="#{bean.model}">

with

private DataModel model;

Either way, they offer a getRowData() method which gives you the row back during bean action method where the UICommand component is been clicked/pressed.

<h:commandLink action="#{bean.view}">

with

public String view() {
    Object rowData = table.getRowData(); // Or model.getRowData();
    return "otherpage";
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜