org.apache.myfaces.custom.fileupload
Class AbstractHtmlInputFileUpload

java.lang.Object
  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:
java.util.EventListener, javax.faces.component.behavior.ClientBehaviorHolder, javax.faces.component.EditableValueHolder, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder, AlignProperty, UserRoleAware
Direct Known Subclasses:
HtmlInputFileUpload

public abstract class AbstractHtmlInputFileUpload
extends javax.faces.component.html.HtmlInputText
implements UserRoleAware, 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.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.faces.component.html.HtmlInputText
javax.faces.component.html.HtmlInputText.PropertyKeys
 
Field Summary
static java.lang.String COMPONENT_TYPE
           
static java.lang.String DEFAULT_RENDERER_TYPE
           
static java.lang.String SIZE_LIMIT_MESSAGE_ID
           
 
Fields inherited from class javax.faces.component.html.HtmlInputText
COMPONENT_FAMILY
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME
 
Fields inherited from class javax.faces.component.UIComponent
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
 
Fields inherited from interface org.apache.myfaces.component.UserRoleAware
ENABLED_ON_USER_ROLE_ATTR, VISIBLE_ON_USER_ROLE_ATTR
 
Constructor Summary
AbstractHtmlInputFileUpload()
           
 
Method Summary
abstract  java.lang.String getAccept()
          This attribute specifies a comma-separated list of content types that a server processing this form will handle correctly.
abstract  java.lang.String getStorage()
          This setting was intended to allow control over how the contents of the file get temporarily stored during processing.
 UploadedFile getUploadedFile()
           
 java.lang.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(UploadedFile upFile)
           
protected  void validateValue(javax.faces.context.FacesContext context, java.lang.Object convertedValue)
           
 
Methods inherited from class javax.faces.component.html.HtmlInputText
getAccesskey, getAlt, getAutocomplete, getDefaultEventName, getDir, getEventNames, 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, 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, clearInitialState, compareValues, decode, getConvertedValue, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isImmediate, isLocalValueSet, isRequired, isValid, markInitialState, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, restoreState, saveState, 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
addClientBehavior, addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, initialStateMarked, invokeOnComponent, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, visitTree
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent
 
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
getAlign
 
Methods inherited from interface javax.faces.component.behavior.ClientBehaviorHolder
addClientBehavior, getClientBehaviors
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

DEFAULT_RENDERER_TYPE

public static final java.lang.String DEFAULT_RENDERER_TYPE
See Also:
Constant Field Values

SIZE_LIMIT_MESSAGE_ID

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

AbstractHtmlInputFileUpload

public AbstractHtmlInputFileUpload()
Method Detail

setUploadedFile

public void setUploadedFile(UploadedFile upFile)

getUploadedFile

public UploadedFile getUploadedFile()

getStorage

public abstract java.lang.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


getAccept

public abstract java.lang.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")."


getValue

public java.lang.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
Overrides:
getValue in class javax.faces.component.UIInput

isRendered

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

validateValue

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


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