Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This,</p> <pre><code>import javax.faces.view.ViewScoped; </code></pre> <p>is the <a href="http://docs.oracle.com/javaee/7/api/javax/faces/view/ViewScoped.html" rel="noreferrer">JSF 2.2-introduced CDI-specific</a> annotation, intented to be used in combination with CDI-specific bean management annotation <code>@Named</code>. </p> <p>However, you're using the JSF-specific bean management annotation <code>@ManagedBean</code>. </p> <pre><code>import javax.faces.bean.ManagedBean; </code></pre> <p>You should then be using any of the scopes provided by the very same <a href="http://docs.oracle.com/javaee/7/api/javax/faces/bean/package-summary.html" rel="noreferrer"><code>javax.faces.bean</code> package</a> instead. The right <a href="http://docs.oracle.com/javaee/7/api/javax/faces/bean/ViewScoped.html" rel="noreferrer"><code>@ViewScoped</code></a> is over there:</p> <pre><code>import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean @ViewScoped public class MenusBean implements Serializable{ </code></pre> <p>If you use the wrong combination, the bean behaves as a <code>@RequestScoped</code> bean and be recreated on each call.</p> <p>Alternatively, if your environment supports CDI (GlassFish/JBoss/TomEE with Weld, OpenWebBeans, etc), then you could also replace <code>@ManagedBean</code> by <code>@Named</code>:</p> <pre><code>import javax.inject.Named; import javax.faces.view.ViewScoped; @Named @ViewScoped public class MenusBean implements Serializable{ </code></pre> <p>It's recommended to move to CDI. The JSF-specific bean management annotations are candidate for deprecation in future JSF / Java EE versions as everything is slowly moving/unifying towards CDI.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload