0
votes

I have a data table with 5 columns. The first column contains:

<p:column headerText="Ordine" filterBy="#{item.numeroOrdineLavoro}"
          sortBy="#{item.numeroOrdineLavoro}">

    <p:commandLink value="#{item.numeroOrdineLavoro}"
                   process="@this"
                   action="#{Bean_OrdiniLavoro.cmdSeleziona_Ordine}">

        <f:setPropertyActionListener target="#{Bean_OrdiniLavoro.sel_OrdineLavoro}" 
                                     value="#{item}" />
    </p:commandLink>
</p:column>

Bean_OrdiniLavoro is ViewScoped. Bean_OrdiniLavoro.cmdSeleziona_Ordine redirects in a new page.

Every times i click on the commandlink Bean_OrdiniLavoro is ReCreated. This is the problem.

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
</context-param>

Primefaces 3.5 and JSF 2.1.22.

I have read many post saying that PARTIAL_STATE_SAVING = false is enough But in this case it doesn't work.

If I use a instead of it works.

thanks a lot. Davide

1
What this function is returning : Bean_OrdiniLavoro.cmdSeleziona_Ordine ? - Alexandre Lavoie
if I use "Page_EditOrdine.xhtml?faces-redirect=true" it ReCreate the Bean. With return = null and //FacesContext.getCurrentInstance().getExternalContext().redirect("Page_EditOrdine.xhtml"); it works - Davide Lo Giudice
That fixes your problem? - Alexandre Lavoie
yes but I don't know why :-) - Davide Lo Giudice

1 Answers

0
votes

When using action property of p:commandButton, the return value is where you want to navigate. If you are returning a non-null value, your current view will terminate in favor of the new one.

If you want to stay in the same view, you must return a null value or void.

public String cmdSeleziona_Ordine()
{
    return null;
}

or

public void cmdSeleziona_Ordine()
{

}