title: JSF 2.0 File upload
body: <p>I am looking around a few blogs, to try to find how to upload files using JSF 2.0
  But all the solutions kind of confuse me. I would like to know what do I exactly need to be able to successfully upload a file(MP3, PDF, video... what ever type) and store it in a database as a @Lob. 
  This is what I have done so far:</p>
  
  <ul>
  <li><p>I created an entity that has an attribute of type byte[] and it is also annotated with a @Lob annotation.</p></li>
  <li><p>I created an EJB that will introduce the entity with with a method that has a byte[] as a parameter and inserts it into the database using the EntityManager class( persist method).</p></li>
  <li><p>I created a JSF page with an input tag of type "file" and a submit button</p></li>
  <li><p>I prepared a managed bean to interchange information about the file with the JSF page.</p></li>
  </ul>
  
  <p>Now I am stuck, and I have lots of doubts:</p>
  
  <ul>
  <li><p>What should I do to pass the file from the JSF to the managed bean and then transform it to a byte[](To be able to handle it over to the EJB)?</p></li>
  <li><p>How can a servlet help me? </p></li>
  <li><p>Do I need a servlet to do this?</p></li>
  <li><p>Also I found that in some blog it mentions something about servlets 3.0, but I don't know if my working environment is using it, how can if I am using servlets 3.0 (I am using JEE6)?</p></li>
  </ul>
  
  <p>I never did file upload before and also I am not very familiar with servlets. I am confused, someone could give me some starting tips, please?</p>