How to Add a richTextEditor Component

Using Input Components and Defining Forms 9-35 ■ indent: Outdent and indent buttons. ■ link: Add and remove Link buttons. For example, if you created two facets named customToolbar1 and customToolbar2, and you wanted the complete default toolbar to appear in between your custom toolbars, you would enter the following list: ■ customToolbar1 ■ all ■ customToolbar2 You can also determine the layout of the toolbars using the following keywords: ■ newline: Places the toolbar in the next named facet or the next keyword from the list in the toolboxLayout attribute on a new line. For example, if you wanted the toolbar in the customToolbar2 facet to appear on a new line, you would enter the following list: – customToolbar1 – all – newline – customToolbar2 If instead, you did not want to use all of the default toolbar, but only the font, color, and common formatting buttons, and you wanted those buttons to appear on a new line, you would enter the following list: – customToolbar1 – customToolbar2 – newline – font – color – formatCommon ■ stretch: Adds a spacer component that stretches to fill all available space so that the next named facet or next keyword from the default toolbar is displayed as right-aligned in the toolbar.

9.9 Using File Upload

The inputFile component provides users with file uploading and updating capabilities. This component allows the user to select a local file and upload it to a selectable location on the server. To download a file from the server to the user, see Section 18.4.1, How to Use a Command Component to Download Files. The inputFile component delivers the standard ValueChangeEvent event as files are being uploaded, and it manages the loading process transparently. The value property of an inputFile component is set to an instance of the org.apache.myfaces.trinidad.model.UploadedFile class when a file is uploaded. To initiate the upload process, you can create an action component such as a command button, as shown in Figure 9–34 . 9-36 Web User Interface Developers Guide for Oracle Application Development Framework Figure 9–34 inputFile Component Once a file has been uploaded, and so the value of the inputFile is not null either after the initial load is successful or it has been specified as an initial value, you can create an Update button that will be displayed instead of the Browse button, as shown in Figure 9–35 . This will allow the user to modify the value of the inputFile component. Figure 9–35 inputFile Component in Update Mode You can also specify that the component be able to load only a specific file by setting the readOnly property to true, In this mode, only the specified file can be loaded, as shown in Figure 9–36 . Figure 9–36 inputFile Component in Read-Only Mode For security reasons, the following attributes cannot be set from the client: ■ disabled unless the unsecure property is set. For more information, see Section 3.6.2, How to Unsecure the disabled Property. ■ immediate ■ readOnly ■ requiredMessageDetail ■ value The inputFile component can be placed in either an h:form tag or an af:form tag, but in either case, you have to set the form tag to support file upload. If you use the JSF basic HTML h:form, set the enctype to multipartform-data. This would make the request into a multipart request to support file uploading to the server. If you are using the ADF Faces af:form tag, set usesUpload to true, which performs the same function as setting enctype to multipartform-data to support file upload. The rich client framework performs a generic upload of the file. You should create an actionListener or action method to process the file after it has been uploaded for example, processing xml files, pdf files, and so on. The value of an inputFile component is an instance of the org.apache.myfaces.trinidad.model.UploadedFile interface. The API lets you get at the actual byte stream of the file, as well as the files name, its MIME type, and its size. The uploaded file may be stored as a file in the file system, but may also be stored in memory; the API hides that difference. The filter ensures that the UploadedFile content is cleaned up after the request is complete. Because of this, you cannot usefully Note: The API does not allow you to get path information from the client about from where the file was uploaded.