Class AbstractHtmlInputFileUpload

  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by javax.faces.component.html.HtmlInputText
                      extended by org.apache.myfaces.custom.fileupload.AbstractHtmlInputFileUpload
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, org.apache.myfaces.component.AlignProperty, org.apache.myfaces.component.UserRoleAware

public abstract class AbstractHtmlInputFileUpload
extends javax.faces.component.html.HtmlInputText
implements org.apache.myfaces.component.UserRoleAware, org.apache.myfaces.component.AlignProperty

Creates a file-selection widget in the rendered page which allows a user to select a file for uploading to the server.

When the page is selected (using a command component such as commandButton), the currently selected file contents are included in the data posted to the server. The contents are cached somewhere, and an object of type UploadedFile will then be assigned to the property pointed to by the "value" expression of this component.

You must enable the Tomahawk ExtensionsFilter to make this component work (see web.xml).

Also, don't forget to set the form's attribute "enctype" to "multipart/form-data". See "examples/web/fileupload.jsp" for an example!

Unless otherwise specified, all attributes accept static values or EL expressions.

$Revision: 1146523 $ $Date: 2011-07-13 19:20:18 -0500 (Wed, 13 Jul 2011) $
Manfred Geiler (latest modification by $Author: lu4242 $)

Field Summary
static String COMPONENT_TYPE
Fields inherited from class javax.faces.component.html.HtmlInputText
Fields inherited from class javax.faces.component.UIInput
Fields inherited from class javax.faces.component.UIComponent
Fields inherited from interface org.apache.myfaces.component.UserRoleAware
Constructor Summary
Method Summary
abstract  String getAccept()
          This attribute specifies a comma-separated list of content types that a server processing this form will handle correctly.
abstract  String getStorage()
          This setting was intended to allow control over how the contents of the file get temporarily stored during processing.
 org.apache.myfaces.custom.fileupload.UploadedFile getUploadedFile()
 Object getValue()
          An EL expression to which an UploadedFile object will be assigned on postback if the user specified a file to upload to the server.
 boolean isRendered()
 void setUploadedFile(org.apache.myfaces.custom.fileupload.UploadedFile upFile)
protected  void validateValue(javax.faces.context.FacesContext context, Object convertedValue)
Methods inherited from class javax.faces.component.html.HtmlInputText
getAccesskey, getAlt, getAutocomplete, getDir, getFamily, getLabel, getLang, getMaxlength, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getSize, getStyle, getStyleClass, getTabindex, getTitle, isDisabled, isReadonly, restoreState, saveState, setAccesskey, setAlt, setAutocomplete, setDir, setDisabled, setLabel, setLang, setMaxlength, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setReadonly, setSize, setStyle, setStyleClass, setTabindex, setTitle
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, compareValues, decode, getConvertedValue, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, setConverter
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.myfaces.component.UserRoleAware
getEnabledOnUserRole, getVisibleOnUserRole, setEnabledOnUserRole, setVisibleOnUserRole
Methods inherited from interface org.apache.myfaces.component.AlignProperty
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter

Field Detail


public static final String COMPONENT_TYPE
See Also:
Constant Field Values


public static final String DEFAULT_RENDERER_TYPE
See Also:
Constant Field Values


public static final String SIZE_LIMIT_MESSAGE_ID
See Also:
Constant Field Values
Constructor Detail


public AbstractHtmlInputFileUpload()
Method Detail


public void setUploadedFile(org.apache.myfaces.custom.fileupload.UploadedFile upFile)


public org.apache.myfaces.custom.fileupload.UploadedFile getUploadedFile()


public abstract String getStorage()
This setting was intended to allow control over how the contents of the file get temporarily stored during processing.

It allows three options


public abstract String getAccept()
This attribute specifies a comma-separated list of content types that a server processing this form will handle correctly. User agents may use this information to filter out non-conforming files when prompting a user to select files to be sent to the server (cf. the INPUT element when type="file")."


public Object getValue()
An EL expression to which an UploadedFile object will be assigned on postback if the user specified a file to upload to the server.

Specified by:
getValue in interface javax.faces.component.ValueHolder
getValue in class javax.faces.component.UIInput


public boolean isRendered()
isRendered in class javax.faces.component.UIComponentBase


protected void validateValue(javax.faces.context.FacesContext context,
                             Object convertedValue)
validateValue in class javax.faces.component.UIInput

Copyright © 2012 The Apache Software Foundation. All Rights Reserved.