I'm migrating from RichFaces 3.3.3 to 4.0, and have come across a problem that can't figure out how to solve.
Until now, I've used RichFaces'@KeepAlive annotation to achieve View scope with beans, but new version 4 doesn't have such feature (as far as I know) so far. So I thought the @ViewScoped annotation would be the natural (and quick) replacement, but it's not working. Here's the relevant code that is giving me trouble. It renders a table containing the customers with their names as links, so when a name is clicked it raises a popup to edit the data. It works in v3.3.3 with @KeepAlive, but does not in v4 with @ViewScoped (popup doesn't get called).
The page:
<h:form prependId="false">
<rich:dataTable id="table" value="#{myBean.customers}" var="customer">
<!--...headers...-->
<h:column>
<a4j:commandLink action="#{myBean.selectCustomer}"
oncomplete="#{rich:component('popup_customer_editor')}.show();" render="form_customer_editor">
${customer.name}
<f:setPropertyActionListener value="#{customer}" target="#{myBean.selectedCustomer}"/>
</a4j:commandLink>
</h:column>
<h:column>${customer.address}</h:column>
</rich:dataTable>
</h:form>
<rich:popupPanel id="popup_customer_editor>
<h:form id="form_customer_editor">
<!--...form fields...-->
</h:form>
</rich:popupPanel>
The bean:
@ManagedBean
@ViewScoped //It was @KeepAlive before
public class MyBean implements Serializable
{
private String name;
private String address;
private Customer selectedCustomer; //POJO class
//getters and setters
...
public String selectCustomer()
{
name = selectedCustomer.getName();
address = selectedCustomer.getAddress();
return null;
}
}
Any help would be appreciated