Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Several ways:</p> <ul> <li><p>Use <a href="http://download.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html#getSessionMap%28%29" rel="noreferrer"><code>ExternalContext#getSessionMap()</code></a></p> <pre><code>ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); Map&lt;String, Object&gt; sessionMap = externalContext.getSessionMap(); sessionMap.put("somekey", yourVariable); </code></pre> <p>And then later:</p> <pre><code>SomeObject yourVariable = (SomeObject) sessionMap.get("somekey"); </code></pre></li> <li><p>Or, make it a property of a session scoped bean which you inject in your request scoped bean.</p> <pre><code>sessionBean.setSomeVariable(yourVariable); </code></pre> <p>And then later:</p> <pre><code>SomeObject yourVariable = sessionBean.getSomeVariable(); </code></pre> <p>Injection of beans in each other can happen by <code>faces-config.xml</code> as described <a href="http://balusc.blogspot.com/2006/06/communication-in-jsf.html#InjectingManagedBeansInEachOther" rel="noreferrer">here</a> or if you're already on JSF 2.0, by <a href="http://download.oracle.com/javaee/6/api/javax/faces/bean/ManagedProperty.html" rel="noreferrer"><code>@ManagedProperty</code></a></p> <pre><code>@ManagedBean @RequestScoped public class RequestBean { @ManagedProperty("#{sessionBean}") private SessionBean sessionBean; // ... } </code></pre> <p>with</p> <pre><code>@ManagedBean @SessionScoped public class SessionBean { private SomeObject someVariable; // ... } </code></pre></li> </ul>
    singulars
    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. 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