@ManagedProperty nie odzwierciedla zmian i zwraca wartość NULL

Usiłuję wstrzyknąć wartość jednego komponentu bean sesji sesyjnej do komponentu bean viewscoped, ale zwraca on wartość null, oto fragment kodu:

<code>import javax.faces.application.FacesMessage;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

//Class for managing the current logged-in user
@ManagedBean(name="user")
@SessionScoped
public class User implements Serializable{

private String userName;

public void setUserName(String userName) {
    this.userName = userName;
}
public String getUserName() {
    return this.userName;
}
</code>

I jest używany w:

<code>@ManagedBean(name="databrowser")
@ViewScoped
public class dataBrowser implements Serializable {  

private List<UploadData> dataItems;
private SelectItem[] dataTypeOptions, qualityOptions, accessOptions;
private UploadData selectedData;
private String filelocation;

@ManagedProperty(value="#{user.userName}")
private String userName;

public String getUserName() {
    return this.userName;
}
</code>

dataBrowser jest używany do wypełnienia datatable Primefaces, gdy jest nazywany userName ma wartość null i nie jestem pewien dlaczego.

questionAnswers(5)

yourAnswerToTheQuestion