I have the following UserView
class:
@ManagedBean(name="usersView", eager=true)
@ApplicationScoped
public class UserView
{
...
public void setUsers(...)
{
...
}
}
I then have another class, UserService
which tries to access this bean and then call this method, as follows:
UserView usersView = (UserView) FacesContext.getCurrentInstance().getExternalContext().getSessionMap("usersView");
usersView.setUsers(...)
My issue is, is that usersView
keeps coming back as null and hence the method cannot be called.
My end goal is to use this data in a PrimeFaces
datatable
, like so:
<p:dataTable var="user" value="#{usersView.users}" ...>
I have also tried changing the scope to SessionScoped
, but it is still null and I cannot figure out why.
Any suggestions would be greatly appreciated.