10 Replies Latest reply on Oct 25, 2007 9:04 AM by mheidt

    T or F? - <s:link/> in dataTable must use @DataModel or REST

      Just a simple yes or no question. From my reading about s:link it looks like if you want to use it in a clickable list you must either use it conjunction with the @DataModel annotation in your session bean or you must use a RESTful approach by sending in the id of the component on the list and look it up again on the server side.

      I found that if I used s:link in a dataTable it did not inject the object in the DataTable into the session bean. Once I changed the link to an <h:commandLink> the selected object on the data table would be properly injected into my session bean.

      This injects the selected object from datatable:

      <h:commandLink value="Edit" action="#{officeTransmittalAction.editClientTransmittalLineItem}" />

      This does not inject the selected object from the datatable without @DataModel
      <s:link value="Edit" action="#{officeTransmittalAction.editClientTransmittalLineItem}" />

      <rich:dataTable value="#{clientTransmittal.lineItemsList}"
       rendered="#{not empty clientTransmittal.lineItemsList}"
       <f:facet name="header">description</f:facet>
       <h:outputText value="#{lineItem.description}" />
       <rich:spacer />
       <f:facet name="header">
       <rich:spacer />
       <h:commandLink value="Edit"
       action="#{officeTransmittalAction.editClientTransmittalLineItem}" />

      public class OfficeTransmittalsActionImpl implements OfficeTransmittalsAction {
       @In(required=false,value = "lineItem") @Out(required = false, value = "lineItem")
       private ClientTransmittalLineItemVO clientTransmittalLineItemx;
       public String editClientTransmittalLineItem()
       return null;