Using the bridge:inputFile UI Component

Liferay Faces Bridge provides bridge-specific UIComponent tags as part of its component suite. In this tutorial, you’ll explore the bridge:inputFile tag and learn what it can do for your JSF portlet.

The bridge:inputFile tag renders an HTML <input type="file"/> tag, providing file upload capability.

<?xml version="1.0" encoding="UTF-8"?>
<f:view xmlns=""
    <h:head />
            <bridge:inputFile fileUploadListener="#{backingBean.handleFileUpload}" multiple="multiple" />
            <h:commandButton value="Submit" />

Here’s a code snippet from a class that imports the FileUploadEvent class and implements handling the file upload:

import com.liferay.faces.bridge.event.FileUploadEvent;


@ManagedBean(name = "backingBean")
public class ApplicantBackingBean implements Serializable {

        public void handleFileUpload(FileUploadEvent fileUploadEvent)
        throws Exception {
            UploadedFile uploadedFile = fileUploadEvent.getUploadedFile();
            System.err.println("Uploaded file:" + uploadedFile.getName());

Fantastic! You can add another UIComponent to your repertoire!

Liferay Faces Alloy UI Components

Understanding Liferay Faces Bridge

« Introduction to Liferay Faces Bridge UI ComponentsUsing the portlet:actionURL UI Component »
Was this article helpful?
0 out of 0 found this helpful