| |
|
|
|
 |
Home NewsProducts Download Buy Now Documentation Support |
 |
 |
|
|
 |
| |

Contents
|
10. ICEfaces Tag Reference
Contents > ICEfaces Tag Reference > ice:inputFile
ice:inputFile |
|
The ice:inputFile tag renders an file input HTML element. Users specify a file to upload either by entering the path to a file directly, or by clicking the Browse button to open a file-system navigation dialog window. Clicking the Upload button uploads the specified file to the server. The inputFile component can be used to provide a user-specified file upload capability.
Note: The inputFile component must render itself inside a form with its encode type set to "multipart/form-data". This limitation prevents using the inputFile component inside another form.
Note: The web.xml parameter com.icesoft.faces.uploadDirectoryAbsolute when set to true will use the value of the com.icesoft.faces.uploadDirectory parameter as an absolute directory.
Note: If the styleClass, buttonClass or the inputTextClass need to be set, then the css file must be referenced using the
ice:outputStyle
component.
Example
<ice:inputFile value="Select File"/>
Rendered Output
|
Tag Attributes
| accept |
Text |
| |
| The accept attribute sets the list of content types that the server will accept. |
| accesskey |
Text |
| |
| The accesskey attribute is a standard HTML attribute that sets the access key that transfers focus to this element when pressed. |
| action |
Text |
| |
| The action attribute accepts a method-binding expression for a backing bean action method to invoke when this component is activated by the user. An action method must be a public method with no parameters that returns a String. The returned string represents the logical outcome of the action (eg. "success", "failure", etc.) and is used by the JavaServer Faces MVC framework to determine which view to display next. |
| actionListener |
Text |
| |
| The actionListener attribute accepts a method-binding expression for a backing bean action listener method that will be notified when this component is activated by the user. An action listener method must be a public method with an javax.faces.event.ActionEvent parameter and a void return type. |
| binding |
Expression |
| |
| The value-binding expression linking this component tag to a backing bean property. |
| disabled |
Boolean |
| |
| The disabled attribute is a boolean flag that when set to true indicates that this component should not receive focus or be included in a form submit. |
| enabledOnUserRole |
Text |
| |
| The enabledOnUserRole attribute is a boolean flag that when set to "true" and if a role has been configured for the user, then the component will be displayed and will function. If the user does not have a role, then the component will be disabled (will not function) and will be grayed out. |
| file |
Text |
| |
| The file attribute sets the name of the backing bean property that will be a reference to the uploaded file. Note: This is deprecated. Instead you should use actionListener, and when in the callback method, call InputFile.getFileInfo(), which will give you information on both successful and failed file upload attempts. |
| fileNamePattern |
Text |
| |
| The fileNamePattern attribute sets the pattern with which the name of the file being uploaded which must conform. The regular expression can be use to define the valid file name to be uploaded.
If the file name does not match with the pattern, the file will not be uploaded and an actionEvent and an exception would be fired and thrown respectively. The default pattern is set to ".+" for any name lenght > 0. For example, to allow only .pdf files to be uploaded, the pattern would be ".+\.pdf". |
| height |
Text |
| |
| The height attribute sets the height for this component. |
| id |
Text |
| |
| The unique identifier value for this component. The value must be unique within the closest naming container. |
| inputTextClass |
CSS Class |
| |
| The inputTextClass attribute sets the CSS style class for the input text. |
| inputTextSize |
Text |
| |
| The inputTextSize attribute sets the size of the input text. |
| label |
Text |
| |
| The label attribute sets the text that is displayed on the component. |
| onblur |
Text |
| |
| The onblur attribute sets the JavaScript code to execute when this element loses focus. |
| onchange |
Text |
| |
| The onchange attribute sets the JavaScript code to execute when this element loses focus and its value changes after gaining focus. |
| onfocus |
Text |
| |
| The onfocus attribute sets the JavaScript code to execute when the element receives focus. |
| progressListener |
Text |
| |
| The progressListener attribute sets a reference to a method representing a progress listener method that will notify the application on the percentage of the file being uploaded. The expression must evaluate to a public method that takes an java.util.EventObject parameter, with a return type of void.
These are some things to consider when implementing the progressListener.
* Method must take a single argument of type java.util.EventObject.
* Developer must invoke the render() call on the PersistentFacesState instance, in order to render the page.
* Beans which implement the progressListener must be in session scope.
* The PersistentFacesState must be set in the constructor of session bean.
|
| rendered |
Boolean |
| |
| A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered. |
| renderedOnUserRole |
Text |
| |
| The renderedOnUserRole attribute is a boolean flag that when set to "true" and if a role has been configured for the user, then the component will be displayed. If the user does not have a role, then the component will not be displayed. |
| style |
CSS Style |
| |
| The style attribute sets the CSS style definition to be applied to this component when it is rendered. |
| styleClass |
CSS Class |
| |
| The styleClass attribute sets the CSS class to apply to this component when it is rendered. |
| tabindex |
Text |
| |
| The tabindex attribute is a standard HTML attribute that sets the order in which this element receives focus when the user cycles through the elements using the TAB key. The value for this attribute must be an integer between 0 and 32767. |
| title |
Text |
| |
| The title attribute is a standard HTML attribute that sets the tooltip text to display for the rendered component. |
| uniqueFolder |
Boolean |
| |
| The uniqueFolder attribute is a boolean flag that when set to "true" and the com.icesoft.faces.uploadDirectory parameter is set, then /application-context/uploadDirectory/sessionid/ is used; when the com.icesoft.faces.uploadDirectory parameter is not set, then /application-context/sessionid/ is used. When this attribute is "false" and the com.icesoft.faces.uploadDirectory parameter is set, then /application-context/uploadDirectory/ is used; when the com.icesoft.faces.uploadDirectory parameter is not set, then /application-context/ is used. |
| uploadDirectory |
Text |
| |
| The uploadDirectory attribute sets the directory where any uploaded files should be placed. This attribute overrides the com.icesoft.faces.uploadDirectory context-param for this specific inputFile. |
| uploadDirectoryAbsolute |
Text |
| |
| The uploadDirectoryAbsolute attribute sets if the uploadDirectory should be interpretted as an absolute path into the filesystem, or as a relative path from the deployment directory. This attribute overrides the com.icesoft.faces.uploadDirectoryAbsolute context-param for this specific inputFile. |
| value |
Text |
| |
| The value attribute sets the current value for this component. |
| width |
Text |
| |
| The width attribute sets the width of the component. |
|
|
|
| |
|