You see the Properties window for a File Upload component when you select the component on a page that you are editing in the Visual Designer.
Most of the File Upload component's properties are both JSP attributes and properties of the Upload
Java component in the page bean.
This JavaServer Faces 1.2 component has the following properties.
Type: String
Type: int
style
property. For example, Internet Explorer observes the width setting, but Mozilla does not. Also, the component is usually larger in the Visual Designer than it is in the web browser and might not appear to line up correctly, so be sure to test the component's appearance in the web browser and adjust the component as needed in the Visual Designer. Type: String
label
property is not as flexible as the Label component. You can use the Label component if you want more control over the label's appearance, such as positioning of the label relative to the component. Type: int
Type: String
position: absolute; left: 288px; top: 312px
You can enter values directly or click the ellipsis (...) button to use the Style Editor.
For a list of CSS2 style attributes, see the web page at
Type: String
style
property description for an explanation of why a class added to this property might appear to have no effect on the component. Type: boolean
for
property to this component, an error message will be displayed if the user tries to submit the page without entering a value. Type: UploadedFile
com.sun.webui.jsf.model.UploadedFile
. This property is read-only and cannot be set in the Properties window. You can use the corresponding Java Upload
component's getUploadedFile()
method to access the uploaded file's contents. Type: MethodExpression
Choose a validator from the drop down list. If you choose (null)
, no validator is called. If you choose a validator, you might also want to select the required
property to ensure that the user enters a value.
Type: boolean
readOnly
property concerning the effects of using the disabled
property versus the effects of using the readOnly
property. Type: boolean
disabled
property, JavaServer Faces does not detect that any value at all was submitted. Type: String
title
attribute of the component, which is readable by a screen reader and can be displayed as a tool tip.
Type: boolean
rendered
property. Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: boolean
The most common example of an immediate action is a Cancel button. You make it immediate so that the normal validation and update steps can be skipped, but the action handler can still do whatever is necessary. Typically, the action handler will navigate back to some previous page. In some designs the action handler might also enqueue an informational message like "Transaction cancelled". It is possible to do more: for example, an application might record the fact that the user cancelled the current operation.
Type: boolean
If preservePath
is selected (true), the component preserves the literal value of the file input element set by the user on the client. The reason this property is provided is that browsers handle the value of an HTML input element of type file
differently. Some browsers submit the literal value of the input element in the multipart/form-data file portion of the request, and others submit only the file name portion and not the directory portion.
If this property is selected, the literal value (typically the full path name either entered explicitly by the user or set by choosing from a file selection dialogue) is stored and submitted in a hidden field. The UploadRenderer
preserves the full file path in the corresponding UploadFilterFileItem
instance, which is encapsulated by the UploadedFile
instance. You can retrieve the saved path by using the UploadedFile
object's getClientFilePath
method.
For example, there is a File Upload component named fileUpload1, and its preservePath property is checked. There is also a button and a message group component on the page. Adding the following code to the button component's action method displays the client file path in the message group component:
UploadedFile uploadedFile1 = fileUpload1.getUploadedFile(); info("Uploaded file's client file path: '" + uploadedFile1.getClientFilePath() + "'");
Type: boolean
You can bind this property to a JavaBeans property that determines when the file upload does get rendered. For example, an airline reservation form might show a file upload for frequent flyers and not show it for the general public. To bind this property, click the ellipsis button (...) to the right of the property and choose Use Binding in the dialog box.
Set the event properties by right-clicking the component in the Visual Designer and choosing Edit Event Handler > eventname.
validatorExpression
property, right-click the component and choose Edit Event Handler > validate. The default name for the method is component-id_validate
, where component-id is the value of the component's id
property. When you define this method in this way, the validator
and validate
properties are automatically set for you. If you define a validator, you might also want to select the required
property to ensure that the user enters a value.
validatorExpression
property. If you define your own validate method, do not separately change the value of the validatorExpression
property, or you will lose the connection to your validate method.component-id_processValueChange
, where component-id is the value of the component's id
property.