O'Reilly logo

Mastering JavaServer Faces 2.2 by Anghel Leonard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JSF 2.2 upload feature

JSF developers have waited a long time for a built-in upload component. Until JSF 2.2, the workarounds consisted of using JSF extensions, such as PrimeFaces, RichFaces, and third-party libraries such as Apache Commons FileUpload.

JSF 2.2 comes with an input component dedicated for upload tasks (that renders an HTML input element of type file). This component is represented by the <h:inputFile> tag and it can be used as any other JSF component. The entire list of supported attributes is available at http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets/h/inputFile.html, but the most important ones are as follows:

  • value: This represents the file to be uploaded as a javax.servlet.http.Part object.
  • required: This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required