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:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, AlignProperty, UserRoleAware

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 $)

Field Summary
static String COMPONENT_TYPE
           
static String DEFAULT_RENDERER_TYPE
           
static String SIZE_LIMIT_MESSAGE_ID
           
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
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  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.
 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(UploadedFile upFile)
           
protected  void validateValue(javax.faces.context.FacesContext context, Object convertedValue)
           
 
Methods inherited from class javax.faces.component.html.HtmlInputText
getAccesskey, getAlt, getDir, 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, setDir, setDisabled, 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, getFamily, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, 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, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
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.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final String COMPONENT_TYPE
See Also:
Constant Field Values

DEFAULT_RENDERER_TYPE

public static final String DEFAULT_RENDERER_TYPE
See Also:
Constant Field Values

SIZE_LIMIT_MESSAGE_ID

public static final 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 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 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 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,
                             Object convertedValue)
Overrides:
validateValue in class javax.faces.component.UIInput


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