4 Replies Latest reply on Oct 12, 2009 12:03 PM by B Tomic

    DataModel vs a regular list in rich:dataTable

    B Tomic Newbie

      Both @DataModel and a regular list can be used as a value for a rich:dataTable, but if a regular list is used, the iterating variable can not be used as a parameter in a method binding expression. On the other hand, using @DataModel allows this, but appends parameters to output links that I would rather avoid.


      To clarify:


      <rich:dataTable id="items" var="item" value="#{items}">
      ...
      <s:link id="selectItem" value="Select" action="#{itemList.select(item)}" />
      



      will fail if items is declared like this


      @Out private List<Item> items;



      but will work as expected if items is declared like this


      @DataModel private List<Item> items;


      but this will also append dataModel and some other parameters to the s:link, even if it's used without an action (meaning it doesn't really need data model selection), like this:


      <s:link id="selectItem" value="Select Item" view="/item.xhtml" propagation="none">
              <f:param name="itemId" value="#{item.id}"/>
      </s:link>



      Am I right when I say this? If I am, is there a way to maintain clean URLs like appname.com/item/itemId without sacrificing the ability to use the iterating variable (item) in a parametrized method binding expression?


      Hopefully this makes sense... Anyway, thanks for any advice you decide to share.