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 ajavax.servlet.http.Part
object.required
: This ...
Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.