I have in a seam page for a table rows used a repeater like this:
<a4j:repeat id="r1279186" value="#{PatientList.entities}" var="Patient" rowKeyVar="rowIndex" >
<tr>
<td>
<a4j:commandButton action="#{PatientAction.inject(Patient)}" id="Button_1279184059161" reRender="Button_1287648925796" limitToList="true" />
</td>
<td >
<span >#{Patient.name_fam}</span>
</td>
<td >
<span >#{Patient.name_giv}</span>
</td>
<td>
<s:link id="Page_1234" action="#{PatientAction.inject(Patient)}" view="/somewhere/patient_details.seam" rendered="true" target="_blank" propagation="join" title="VIS" limitToList="true" >
<img src="images/24x24/info.png" title="VIS" alt="VIS}" style="height: 24px;width: 24px;"/>
</s:link>
</td>
</tr>
PatientAction is a bean, with method called inject, which take a Patient class Object in input. PatientList.entities is a List, the repeater cycles on a var named Patient, the same name of object class.
Before return the page to the client, seam renders the name and surname for each patient (row) in list, and add one button in the first column and one link in the last.
Using the button the action is executed when I click the button, receiving in the parameter of inject the Patient corresponding to the row where I pressed the button. [OK!]
When I use the link (which I use to open a new browser page, maintaining the same conversation) the method inject is called exactly when I click, but the parameter passed is null!! (I can see in debug of my inject method, the Patient coming is null)
You cannot pass parameters to an
<s:link/>action from a repeat element, as stated in http://docs.jboss.org/seam/2.0.1.GA/reference/en/html/elenhancements.html#d0e22695Cite:
So, you must use
<h:commandLink/>instead of<s:link/>, alternatively you can create a bookmarkable link as follows:This produces a link like this in HTML:
/somewhere/patient_details.seam?patientId=5. Since the patient ID is carried in the link, thepatient_details.xhtmlpage has the needed information to retrieve the data for display.To do this, you need to put a parameter definition in
patient_details.page.xmlso that the value is picked up before the page is displayed, for example: