Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>They're stored in the view map as available by <a href="http://docs.oracle.com/javaee/7/api/javax/faces/component/UIViewRoot.html#getViewMap%28%29" rel="nofollow noreferrer"><code>UIViewRoot#getViewMap()</code></a>:</p> <pre><code>Map&lt;String, Object&gt; viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap(); ViewScopedBean viewScopedBean = (ViewScopedBean) viewMap.get("viewScopedBean"); // ... </code></pre> <p>Equivalently, you should be using the session map abstraction as well which is available by <a href="http://docs.oracle.com/javaee/7/api/javax/faces/context/ExternalContext.html#getSessionMap%28%29" rel="nofollow noreferrer"><code>ExternalContext#getSessionMap()</code></a> (you ultimately want to have <strong>zero</strong> <code>javax.servlet</code> import declarations throughout your JSF code):</p> <pre><code>Map&lt;String, Object&gt; sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); SessionScopedBean sessionScopedBean = (SessionScopedBean) sessionMap.get("sessionScopedBean"); // ... </code></pre> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/questions/2633112/jsf-get-managed-bean-by-name">Get JSF managed bean by name in any Servlet related class</a></li> </ul> <hr> <p><strong>Unrelated</strong> to the concrete problem, this may not be the best way. Look at <a href="http://docs.oracle.com/javaee/7/api/javax/faces/bean/ManagedProperty.html" rel="nofollow noreferrer"><code>@ManagedProperty</code></a> if possible.</p>
 

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