File upload processing requires the installation of the ADF Faces Filter. This filter is required for all ADF Faces applications. One of its features is handling file uploads. To install the filter, first add the following entry to your WEB-INF/web.xml file:
<filter>
<filter-name>adfFaces</filter-name>
<filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
</filter>
Second, map that filter to process all FacesServlet requests. For example, if you've named the FacesServlet "faces":
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
...then use the following filter-mapping:
<filter-mapping>
<filter-name>adfFaces</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
inputFile
To support uploading a file on your page, use the < af:inputFile > component . Like all other input components, < af:inputFile > sends ValueChangeEvents . And like all ADF Faces input components, it has built-in support for accessibility, labels, and messages.
<af:inputFile label="Upload:"
valueChangeListener="#{backingBean.fileUploaded}"/>
< af:inputFile > can be placed in either an < h:form > tag or an < af:form > tag, but in either case you have to set it to support file upload. For the JSF Basic HTML form, that involves setting the "enctype" to the correct magic value; for the ADF Faces form, just set "usesUpload" to true:
<af:form usesUpload="true">
<af:inputFile label="Upload:"
valueChangeListener="#{backingBean.fileUploaded}"/>
</af:form>
<!-- or -->
<h:form enctype="multipart/form-data">
<af:inputFile label="Upload:"
valueChangeListener="#{backingBean.fileUploaded}"/>
</h:form>
web.xml
<context-param>
<!-- Maximum memory per request (in bytes) -->
<param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
<!-- Use 500K -->
<param-value>512000</param-value>
</context-param>
<context-param>
<!-- Maximum disk space per request (in bytes) -->
<param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
<!-- Use 5,000K -->
<param-value>5120000</param-value>
</context-param>
<context-param>
<!-- directory to store temporary files -->
<param-name>oracle.adf.view.faces.UPLOAD_TEMP_DIR</param-name>
<!-- Use an ADFUploads subdirectory of /tmp -->
<param-value>/tmp/ADFUploads/</param-value>
</context-param>
amigo el contenido de nombre "oracle.adf.view.faces.webapp.AdfFacesFilter"
ReplyDeleteno esta disponible para hacer el filter en mi jdeveloper 11.1.1.6, por el contrario me da esta opcion oracle.adf.view.rich.webapp.AdfFacesFilter
pero el ejemplo no me funciona