Using the inputFile component
The inputFile
component provides end users with file uploading and updating capabilities. It allows selecting a local file and uploading the inputStream
component to a selectable location on the server.
In this recipe, we will add an inputFile
component to mimic saving the user's uploaded image and saving the image filename in the Image
attribute of the Employees
table.
How to do it...
In order to add the inputFile
component, follow the ensuing steps:
Open the
inputComponets.jsf
page.Drag the
Image
attribute underEmployeesView1
inChapter4AppModuleDataControl
from the Data Control pane and drop it inside the panel form layout.Navigate to Text | ADF Input Text w/ Label.
Right-click on the
inputText
component and go to Convert to… | Input File.While selecting the
inputText
component, change theAutoSubmit
attribute totrue
.Change the
Converter
attribute toFileConverter
.Save everything.
Open the
inputComponents.jsf
page.Select
af:form
from the Structure pane.Change...