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>
Thursday, July 15, 2010
Wednesday, July 14, 2010
dynamic regions with adf taskflows
When ADF taskflow dropped as a dynamic region, it prompts for managed bean. Default it creates the manage bean in backing bean scope, according to andrejaus it must be created in pageflow scope.
http://andrejusb.blogspot.com/2010/02/integration-in-oracle-adf-with-adf-task.html
http://andrejusb.blogspot.com/2010/02/integration-in-oracle-adf-with-adf-task.html
Subscribe to:
Posts (Atom)