You cannot pass directly a parameter to your backing bean method using EL. The wiki entry shows some alternative way to pass one parameter putting it somewhere (managed-bean property, request parameter, ...) and having your backing bean method retrieve its value.

I can't see why this approach doesn't fit your scenario. BTW, why your detail dataTable should be nested in the master one? That way you would have *every* row of the master list include its own detail list (thus you don't ever need to pass the "selected" id).

Example:
<t:dataTable id="foo1" var="list" value="#{test.list}">
    ......
   <t:column>
      ......
      <h:commandLink value="Select this item" action="" test.loadSubList}">
         <t:updateActionListener property="#{test.selectedItem}" value="#{list.itemId}"/>
      </h:commandLink>
   <t:column>
</t:dataTable>

<t:dataTable id="foo2" var="video" value="#{test.subList}">
    ......
</t:dataTable>

In your backing bean:

private String selectedItem = null;
public void setSelectedItem(String selectedItem) {
  this.selectedItem = selectedItem;
}
public String getSelectedItem() {
  return this.selectedItem;
}

public List getSubList() {
  // load the list
  ...
  if (this.selectedItem != null) {
    return myListObject.getSubList(this.selectedItem);
  } else {
    return java.util.Collections.EMPTY_LIST;
  }
}


Cosma

2006/6/13, Hailong Zhang <[EMAIL PROTECTED]>:
Hi Adam,
    I have read the wiki, but I think this can not solve my problem. My scenario seems like master/detail, but the master/detail must be displayed in the same page.

    Any other solutions?

Thank you!

2006/6/13, Adam Brod <[EMAIL PROTECTED]>:

This wiki page talks about how to do this:

http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters

Adam Brod

Product Development Team


"Hailong Zhang" <[EMAIL PROTECTED]>

06/12/2006 01:18 PM

Please respond to
"MyFaces Discussion" <users@myfaces.apache.org>

To
users@myfaces.apache.org
cc

Subject
Can I pass a param to the backing bean method?







For example:
<t:dataTable id="foo1" var="list" value="#{test.list">
   ......
   <t:dataTable id="foo2" var="video" value="#{test.subList}">
   ......
   </t:dataTable>
</t:dataTable>

The subList is determined by a property of list but how can I pass the property to test.getSubList() ?

Thank you!
Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.






Reply via email to