html
Tag file


Render A File Select Input Field

Renders an HTML <input> element of type file, defaulting to the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

As with the corresponding HTML <input> element, the enclosing form element must specify "POST" for the method attribute, and "multipart/form-data" for the enctype attribute. For example:

 <html:form method="POST" enctype="multipart/form-data"> <html:file property="theFile" /> </html:form>

WARNING: In order to correctly recognize uploaded files, the ActionForm bean associated with this form must include a statement setting the corresponding org.apache.struts.upload.FormFile property to null in the reset() method.



Tag Information
Tag Classorg.apache.struts.taglib.html.FileTag
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
accesskeyfalsetruejava.lang.StringThe keyboard character used to move focus immediately to this element.
acceptfalsetruejava.lang.StringComma-delimited set of content types that the server you submit to knows how to process. This list can be used by the client browser to limit the set of file options that is made available for selection. If not specified, no content type list will be sent.
altfalsetruejava.lang.String

The alternate text for this element.

altKeyfalsetruejava.lang.String

The message resources key of the alternate text for this element.

bundlefalsetruejava.lang.StringThe servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.
Since:
Struts 1.2.5
dirfalsetruejava.lang.String

The direction for weak/neutral text for this element.

Since:
Struts 1.3.6
disabledfalsetruebooleanSet to true if this input field should be disabled.
errorKeyfalsetruejava.lang.String

Name of the bean (in any scope) under which our error messages have been stored. If not present, the name specified by the Globals.ERROR_KEY constant string will be used.

N.B. This is used in conjunction with the errorStyle, errorStyleClass and errorStyleId attributes and should be set to the same value as the name attribute on the <html:errors/> tag.

Since:
Struts 1.2.5
errorStylefalsetruejava.lang.String

CSS styles to be applied to this HTML element if an error exists for it.

N.B. If present, this overrides the style attribute in the event of an error.

Since:
Struts 1.2.5
errorStyleClassfalsetruejava.lang.String

CSS stylesheet class to be applied to this HTML element if an error exists for it (renders a "class" attribute).

N.B. If present, this overrides the styleClass attribute in the event of an error.

Since:
Struts 1.2.5
errorStyleIdfalsetruejava.lang.String

Identifier to be assigned to this HTML element if an error exists for it (renders an "id" attribute).

N.B. If present, this overrides the styleId attribute in the event of an error.

Since:
Struts 1.2.5
indexedfalsetruebooleanValid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag.
langfalsetruejava.lang.String

The language code for this element.

Since:
Struts 1.3.6
maxlengthfalsetruejava.lang.StringMaximum number of input characters to accept. This is ignored by most browsers. [No limit]
namefalsetruejava.lang.StringThe attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized.
onblurfalsetruejava.lang.StringJavaScript event handler executed when this element loses input focus.
onchangefalsetruejava.lang.StringJavaScript event handler executed when this element loses input focus and its value has changed.
onclickfalsetruejava.lang.StringJavaScript event handler executed when this element receives a mouse click.
ondblclickfalsetruejava.lang.StringJavaScript event handler executed when this element receives a mouse double click.
onfocusfalsetruejava.lang.StringJavaScript event handler executed when this element receives input focus.
onkeydownfalsetruejava.lang.StringJavaScript event handler executed when this element has focus and a key is depressed.
onkeypressfalsetruejava.lang.StringJavaScript event handler executed when this element has focus and a key is depressed and released.
onkeyupfalsetruejava.lang.StringJavaScript event handler executed when this element has focus and a key is released.
onmousedownfalsetruejava.lang.StringJavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed.
onmousemovefalsetruejava.lang.StringJavaScript event handler executed when this element is under the mouse pointer and the pointer is moved.
onmouseoutfalsetruejava.lang.StringJavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element.
onmouseoverfalsetruejava.lang.StringJavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element.
onmouseupfalsetruejava.lang.StringJavaScript event handler executed when this element is under the mouse pointer and a mouse button is released.
propertytruetruejava.lang.StringName of the request parameter that will be included with this submission, set to the specified value.
sizefalsetruejava.lang.StringSize of the file selection box to be displayed.
stylefalsetruejava.lang.String

CSS styles to be applied to this HTML element.

N.B. If present, the errorStyle overrides this attribute in the event of an error for the element.

styleClassfalsetruejava.lang.String

CSS stylesheet class to be applied to this HTML element (renders a "class" attribute).

N.B. If present, the errorStyleClass overrides this attribute in the event of an error for the element.

styleIdfalsetruejava.lang.String

Identifier to be assigned to this HTML element (renders an "id" attribute).

N.B. If present, the errorStyleId overrides this attribute in the event of an error for the element.

tabindexfalsetruejava.lang.StringThe tab order (ascending positive integers) for this element.
titlefalsetruejava.lang.String

The advisory title for this element.

titleKeyfalsetruejava.lang.String

The message resources key for the advisory title for this element.

valuefalsetruejava.lang.String

NOTE: When setting this to some value, whether intentional or as the result (for example) of validation errors forcing the user back to the original jsp, this value is ignored by most browsers (for security reasons). This means that your users will have to re-select any previously selected files when submitting the form. Opera web browser will prompt the user so they have a chance to abort the submit.

Value to which this field should be initialized. [Use the corresponding bean property value or body content (if any) if property is not specified]

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.