414 total views, 9 views today

Oracle ADF File Upload – example

In this section I have explained about the following topics

  • Create an ADF File upload screen
  • Receive the File in server side and prints it on the console
  • Set Maximum number of files user can upload
  • Set maximum size of file user can upload and other parameters

 

Download the project: ADF File Upload

ADF File Upload – example started

One of my JSF fragments has the InputFile component. The InputFile component of ADF allows the user to upload files from the browser. The maximumFiles property limits the number of files user can upload from browser. The ‘value’ property is binds to the bean class.

Created action method for the button component. The methods invoked when the button is clicked . It recieves the file and prints the file content in the console . Here below the full bean class with the action methods

Make sure to set the property usesUpload=”true” in your form component. I have deployed the JSFF fragements in one of my JSF page as a region component. Look below, the usesUpload  property of af:form is set to true

 

Altjough below settings are not a mandatory step, It is good to understand. The following  server-side (web.xml) properties are related to ADF file upload. For example, if you want to increase the file upload size to 10MB then increase the below value of org.apache.myfaces.trinidad.UPLOAD_MAX_FILE_SIZE from 5120000 to 10485760.  The below properties should reside in the context-param settings of web.xml.

Run the application

After run the application on weblogic server, the browser displays like below. I have uploaded a text file and clicked the UploadFile button

081416_2053_OracleADFFi1 Oracle ADF File Upload – example

It reads the file and print it on the console

081416_2053_OracleADFFi2 Oracle ADF File Upload – example

govindan Oracle ADF File Upload – example
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan Oracle ADF File Upload – example
Connect me
By | 2016-12-28T17:09:43+00:00 August 14th, 2016|Categories: ADF|Tags: , , , , |2 Comments
Like us on Facebook.
Connect!