I have a list of objects and each entry has a link to the object's detail view. The code for the link is
<h:link outcome="#{detailViewPageName}" rendered="#{listRow.rowData.dbId != null}">
<f:param name="faces-redirect" value="true" />
<f:param name="phoneNr" value="#{listRow.rowData.phoneNr}" />
<f:param name="fromDate" value="#{listRow.rowData.fromDate}" />
<f:param name="toDate" value="#{listRow.rowData.toDate}" />
#{listRow.rowData.phoneNr == "-1" ? msg.subscriptionPhoneNumberUnknown : listRow.rowData.phoneNr}
</h:link>
and an ex. of a resulting link is:
The bean for the detail view has the params defined with getters and setters and the page has the f:viewparam defined too:
<ui:define name="metadata">
<f:metadata>
<f:viewParam name="phoneNr" value="#{billDetailController.model.phoneNr}"/>
<f:viewParam name="fromDate" value="#{billDetailController.model.fromDate}"/>
<f:viewParam name="toDate" value="#{billDetailController.model.toDate}"/>
<f:event listener="#{billDetailController.selectData}" type="preRenderView" />
</f:metadata>
</ui:define>
The problem is that the values in the detail bean are never set...
Now what I see with the debugger is that after clicking the link (and I assume before the page is loaded and the selectData method is called) the parameters' getters are called, but not the setters.
The bean is ManagedBean and CustomScoped.
What do I miss?
EDIT:
Bean (a very easy one):
@ManagedBean( name = "billDetailModel" )
@ViewScoped
public class BillDetailModel extends DetailModel
{
private String phoneNr;
private Date fromDate;
private Date toDate;
public String getPhoneNr()
{
return phoneNr;
}
public void setPhoneNr( String phoneNr )
{
this.phoneNr = phoneNr;
}
public Date getFromDate()
{
return fromDate;
}
public void setFromDate( Date fromDate )
{
this.fromDate = fromDate;
}
public Date getToDate()
{
return toDate;
}
public void setToDate( Date toDate )
{
this.toDate = toDate;
}
}
maybe check if there are any ConverterExceptions
during JSFs Update-Phase. If you e.g. try to set the date into a getter/setter expecting a Date- or Calendar-Object, this might not work without an proper DateConverter
inbetween.
Hope that helps...