X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    July 23, 2012

How-to reset ADF Faces inputFile components

Frank Nimphius
Master Principal Product Manager

When working with the ADF Faces input file component, you'll notice a
change in the UI after uploading a file in that the file name is displayed as a
label and the upload button text changes to Update.

From a use case perspective this behavior may be fine if you bind the
component value property to a managed bean that you want to update with changed
file uploads. For generic file upload functionality though you probably prefer
the input file to reset its state to the original display: input field and
upload button text as "Browse".

To achieve this, you need to explicitly reset the input file component
in a call to
resetValue() on the RichInputFile component instance.

You can access the RichInputFile component instance from a JSF component binding to a manage bean
(sub-optimal) or from a dynamic component lookup (recommended) in the component
tree, using the
UIViewRoot as a starting point or
using Apache MyFaces Trinidad
ComponentUtils:

http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/util/
ComponentUtils.html

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.