Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-3009

Support JSF 2.2 file upload

    Details

      Description

      JSF 2.2 introduced the javax.faces.component.HtmlInputFile component and associated h:inputFile component tag. The FacesBridge needs to support this feature in a Portlet 3.0 environment using the new javax.portlet.ClientDataRequest#getPart(String) method.

      The javax.servlet.annotation.MultiPartConfig annotation cannot be supported because it is designed to be placed on a servlet class. However, the TCK should test the <multipart-config> element in WEB-INF/web.xml as described in the Java EE 7 Tutorial.

      Example Code:

      fullPagePostback.xhtml
      <h:form enctype="multipart/form-data">
      	<h:inputFile value="#{backingBean.uploadedPart}" />
      	<h:commandButton value="Submit" />
      </h:form>
      
      xhrPostback.xhtml
      <h:form enctype="multipart/form-data">
      	<h:inputFile value="#{htmlInputFileBacking.uploadedPart}" />
      	<h:commandButton value="#{i18n['submit']}">
      		<f:ajax execute="@form" render="@form" />
      	</h:commandButton>
      </h:form>
      
      BackingBean.java
      import javax.servlet.http.Part;
      
      public class BackingBean {
      
      	private Part uploadedPart;
      
      	public void setUploadedPart(Part uploadedPart) {
      		this.uploadedPart = uploadedPart;
      	}
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  facesbridge-tck-5.0.0
                  facesbridge-spec-5.0.0
                  bridge-impl-5.0.0
                  facesbridge-spec-6.0.0
                  facesbridge-tck-6.0.0
                  bridge-impl-6.0.0