title: Can't get view Scoped bean value on another jsf page?
body: <p>I am developing a project using JSF. In an opening popup window, i want to show some details about a product but can not get view scoped bean' s value on a datatable.</p>
  
  <p>Can you help me?</p>
  
  <p>Thanks.</p>
  
  <p>Here is my UrunuDenetlemeSayfasi.xhtml code snippet:</p>
  
  <pre><code>&lt;h:commandLink onclick="window.open('UruneGozAt.xhtml',
  'Ürün İçeriği', config='width=700, height=400, top=100, left=100,
  scrollbars=no, resizable=no');"
  action="#{uruneGozAtBean.urunIdsineGoreUrunIcerigiGetir}" value="Ürün İçeriğine Göz At"&gt;
  &lt;f:param name="urunid" value="#{urun.urunID}" /&gt; 
  &lt;/h:commandLink&gt;
  </code></pre>
  
  <p>Here is UrunuGozAt.xhtml:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
  &lt;h:body&gt;
      &lt;h:dataTable class="table table-striped"
          value="#{uruneGozAtBean.urunIcerik}" var="urun"&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="barkod no" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{urun.barkodNo}" /&gt;
          &lt;/h:column&gt;
      &lt;/h:dataTable&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is UruneGozAtBean.java</p>
  
  <pre><code>    UrunDenetlemeSayfasiBean urunDenetle = new UrunDenetlemeSayfasiBean();
      UrunDenetleService urunService = new UrunDenetleService();
      private UrunIcerik urunIcerik = new UrunIcerik();
      private Long urunIdParametre;
  
      public UrunIcerik getUrunIcerik() {
      return urunIcerik;
      }
      public void setUrunIcerik(UrunIcerik urunIcerik) {
      this.urunIcerik = urunIcerik;
      }
      public Long getUrunIdParametre() {
          return urunIdParametre;
      }
      public void setUrunIdParametre(Long urunIdParametre) {
          this.urunIdParametre = urunIdParametre;
      }
      public void urunIdsineGoreUrunIcerigiGetir() {
          setUrunIcerik(urunService.urunIdsineGoreUrunIcerigiGetir(urunIdEldeEt()));
      }
      public Long urunIdEldeEt(){      
          FacesContext fc = FacesContext.getCurrentInstance();
          setUrunIdParametre(getUrunIdParametre(fc));
          return getUrunIdParametre();
      }
      public Long getUrunIdParametre(FacesContext fc){
          Map&lt;String, String&gt; parametre =        fc.getExternalContext().getRequestParameterMap();
  return Long.valueOf(parametre.get("urunid")).longValue();
      }
  </code></pre>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>This is now my current implementation, it returns <code>null</code>.</p>
  
  <p>i am developing a project using JSF. In an opening popup window, i want to show some details about a product but can not get view scoped bean' s value on a datatable.</p>
  
  <p>Can you help me?</p>
  
  <p>Thanks.</p>
  
  <p>Here is my UrunuDenetlemeSayfasi.xhtml code snippet:</p>
  
  <pre><code>&lt;h:commandLink onclick="window.open('UruneGozAt.xhtml','Ürün İçeriği',
  config='width=700, height=400, top=100, left=100, scrollbars=no, resizable=no');"
  value="Ürün İçeriğine Göz At"&gt; &lt;f:param name="urunId" value="#{urun.urunID}" /&gt;
  &lt;/h:commandLink&gt;
  </code></pre>
  
  <p>Here is UruneGozAt.xhtml:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://xmlns.jcp.org/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
  
  &lt;f:metadata&gt;
  &lt;f:viewParam name="urunId" value="#{uruneGozAtBean.urunId}"
      required="false" /&gt;
  &lt;f:viewAction action="#{uruneGozAtBean.urunIdsineGoreUrunIcerigiGetir()}" /&gt;
  &lt;/f:metadata&gt;
  
  &lt;h:head&gt;
  &lt;title&gt;Ürün İçeriği&lt;/title&gt;
  &lt;!-- add this always, even if it's empty --&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
  &lt;h:dataTable class="table table-striped"
      value="#{uruneGozAtBean.urunIcerik}" var="urun"&gt;
      &lt;h:column&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="barkod no" /&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{urun.barkodNo}" /&gt;
      &lt;/h:column&gt;
  &lt;/h:dataTable&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is UruneGozAtBean.java</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class UruneGozAtBean {
  
  public UrunDenetlemeSayfasiBean urunDenetle = new UrunDenetlemeSayfasiBean();
  
  public UrunDenetleService urunService = new UrunDenetleService();
  
  private ArrayList&lt;UrunIcerik&gt; urunIcerik = new ArrayList&lt;UrunIcerik&gt;();
  
  private Long urunId;
  
  public Long getUrunId() {
      return urunId;
  }
  
  public void setUrunId(Long urunId) {
      this.urunId = urunId;
  }
  
  public ArrayList&lt;UrunIcerik&gt; getUrunIcerik() {
      return urunIcerik;
  }
  
  public void setUrunIcerik(ArrayList&lt;UrunIcerik&gt; urunIcerik) {
      this.urunIcerik = urunIcerik;
  }
  
  public void urunIdsineGoreUrunIcerigiGetir() {
      setUrunIcerik(urunService.urunIdsineGoreUrunIcerigiGetir(urunIdEldeEt()));
      System.out.print("aaa");
  }
  
  public Long urunIdEldeEt() {
      FacesContext fc = FacesContext.getCurrentInstance();
      setUrunId(getUrunId(fc));
      return getUrunId();
  }
  
  public Long getUrunId(FacesContext fc) {
      Map&lt;String, String&gt; parametre =     fc.getExternalContext().getRequestParameterMap();
  return Long.valueOf(parametre.get("urunId")).longValue();
  }
  }
  </code></pre>