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#d0e22695
Cite:
Use inside iterative components — Components like
<c:forEach/>
and<ui:repeat/>
iterate over a List or array, exposing each item in the list to nested components. This works great if you are selecting a row using a<h:commandButton/>
or<h:commandLink/>
.However if you want to use
<s:link/>
or<s:button/>
you must expose the items as aDataModel
, and use a<dataTable/>
(or equivalent from a component set like<rich:dataTable/>
). Neither<s:link/>
or<s:button/>
submit the form (and therefore produce a bookmarkable link) so a "magic" parameter is needed to recreate the item when the action method is called. This magic parameter can only be added when a data table backed by aDataModel
is used."
So, you must use <h:commandLink/>
instead of <s:link/>
, alternatively you can create a bookmarkable link as follows:
<s:link view="/somewhere/patient.details.xhtml">
<f:param name="patientId" value="#{Patient.id}" />
...
</s:link>
This produces a link like this in HTML: /somewhere/patient_details.seam?patientId=5
. Since the patient ID is carried in the link, the patient_details.xhtml
page has the needed information to retrieve the data for display.
To do this, you need to put a parameter definition in patient_details.page.xml
so that the value is picked up before the page is displayed, for example:
<!-- Here we use an EntityHome component, assuming Patient is a JPA entity.
When you set the ID of an EntityHome component, it automatically triggers
an EntityManager.find() call to retrieve the Entity from DB. -->
<param name="patientId" value="#{patientHome.id}" />