I am having a problem with JSF 2.2, I have this struct:
Problem: I can not set variables (by sessionScope - MainBean) since catalog.xhtml (by requestScope/ViewScope - CatalogBean).
LoginBean: SessionScope
@ManagedBean(name="loginBean")
@SessionScoped
public class LoginBean {
private Session userLog;
MainBean: SessionScope
@ManagedBean
@SessionScoped
public class MainBean {
@ManagedProperty(value="#{loginBean}")
private LoginBean userLogin;
CatalogBean: ViewScope/RequestScope
@ManagedBean
@ViewScoped
public class CatalogBean {
@ManagedProperty(value="#{mainBean}")
private MainBean userManagerCatalog;
ItemBean: ViewScope/RequestScope
@ManagedBean
@ViewScoped
public class ItemBean {
@ManagedProperty(value="#{mainBean}")
private MainBean userManagerItem;
The problem is when I enter in item.xhtml (ItemBean) , (since catalog.xhtml) I am saving a variable in MainBean (SessionScope), with:
<p:commandLink action="item.xhtml?faces-redirect=true" actionListener="#{mainBean.setSelectedItem(it)}">
<p:graphicImage library="resources" name="images/folderNormal.png" style="width: 100; height: 100"/>
<f:setPropertyActionListener value="#{it}" target="#{mainBean.selectedItem}" />
</p:commandLink>
Data of Interest
*I had been to using two diferent forms (actionListener and setPropertyActionListener)
**I have to enter catalog to enter the item
*** I am bugging, this makes the change but the next, I see that the program lost this data
**** I had used in Catalog the property SessionScope (fuction well) but I can not change of catalog because the variable does not change its value.
Any help is welcome, thanks in advance