title: Accessing JSF session scoped bean from servlet which is called by applet embedded in JSF webapp
body: <p>I need to access a session scoped bean from a servlet. I already tried</p>
  
  <pre><code>UserBean userBean = (UserBean) request.getSession().getAttribute("userBean");
  </code></pre>
  
  <p>as described in this <a href="https://stackoverflow.com/a/3920184/1644061">post</a>. But I only get null as result, altough an instance of UserBean is alreay instatiated. Those are the annotations/imports I use for userBean :</p>
  
  <pre><code>import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  
  @ManagedBean
  @SessionScoped
  public class UserBean implements Serializable{
   ... }
  </code></pre>
  
  <p>Some Background why I can't get rid of the servlet : I have a file upload applet in my jsf page. This applet expects an adress where it can send it's POST request. (I can't edit this post request to add more fields or something). The post method of my servlet then stores the file. This job can't be done by a managed bean because the servlet has to be annotated with @MultiPartConfig and I can't add this annotation to the jsf managed bean. </p>