com.sun.webui.jsf.component
Class PasswordField

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 com.sun.webui.jsf.component.WebuiInput
                      extended by com.sun.webui.jsf.component.HiddenField
                          extended by com.sun.webui.jsf.component.Field
                              extended by com.sun.webui.jsf.component.PasswordField
All Implemented Interfaces:
com.sun.webui.jsf.component.ComplexComponent, javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, javax.faces.component.ValueHolder

public class PasswordField
extends Field

The PasswordField component is used to create a password textfield.


Field Summary
 
Fields inherited from class com.sun.webui.jsf.component.Field
INPUT_ID, LABEL_FACET, LABEL_ID, READONLY_FACET, READONLY_ID
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
PasswordField()
          Default constructor.
 
Method Summary
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.Object getPassword()
          Value binding.
 java.lang.String getReadOnlyValueString(javax.faces.context.FacesContext context)
          Return the value to be rendered as a string when the component is readOnly.
 java.lang.Object getText()
          Literal value to be rendered in this input field.
 java.lang.Object getValue()
           
 java.lang.String getValueAsString(javax.faces.context.FacesContext context)
          Return the empty Srting to be rendered This is done in order to avoid sending secret password back to the client where it can be sniffed by viewing the source code of the page.
 javax.el.ValueExpression getValueExpression(java.lang.String name)
          Return the ValueExpression stored for the specified name (if any), respecting any property aliases.
 boolean isSubmitForm()
          Flag indicating whether pressing enter in this text field would allow browser to submit the enclosing form.
 boolean isSubmitFormSet()
          Returns true if submitForm attribute has been explicitely set, either through binding, value expression, or programmatically.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setPassword(java.lang.Object password)
          Literal value to be rendered in this input field.
 void setSubmitForm(boolean submitForm)
          Flag indicating whether pressing enter in this text field would allow browser to submit the enclosing form.
 void setValueExpression(java.lang.String name, javax.el.ValueExpression binding)
          Set the ValueExpression stored for the specified name (if any), respecting any property aliases.
 
Methods inherited from class com.sun.webui.jsf.component.Field
getColumns, getFocusElementId, getIndicatorComponent, getLabel, getLabelComponent, getLabeledElementId, getLabelLevel, getMaxLength, getOnBlur, getOnChange, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getPrimaryElementID, getReadOnlyComponent, getStyle, getStyleClass, getTabIndex, getToolTip, isDisabled, isReadOnly, isRequired, isTrim, isVisible, setColumns, setDisabled, setLabel, setLabelLevel, setMaxLength, setOnBlur, setOnChange, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setReadOnly, setStyle, setStyleClass, setTabIndex, setText, setToolTip, setTrim, setVisible
 
Methods inherited from class com.sun.webui.jsf.component.HiddenField
getHtmlTemplate, getRendererType, setHtmlTemplate
 
Methods inherited from class com.sun.webui.jsf.component.WebuiInput
broadcast, getValidator, getValidatorExpression, getValueChangeListener, getValueChangeListenerExpression, processDecodes, processUpdates, processValidators, setConverter, setId, setImmediate, setRendered, setRequired, setValidatorExpression, setValueChangeListenerExpression
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, decode, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidatorMessage, getValidators, getValueChangeListeners, isImmediate, isLocalValueSet, isValid, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setLocalValueSet, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue
 
Methods inherited from class javax.faces.component.UIComponentBase
encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue
 

Constructor Detail

PasswordField

public PasswordField()
Default constructor.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

Overrides:
getFamily in class Field

getReadOnlyValueString

public java.lang.String getReadOnlyValueString(javax.faces.context.FacesContext context)

Return the value to be rendered as a string when the component is readOnly. The value will be represented using asterisks.

Overrides:
getReadOnlyValueString in class HiddenField
Parameters:
context - FacesContext for the current request
Returns:
A String value of the component

getValueExpression

public javax.el.ValueExpression getValueExpression(java.lang.String name)

Return the ValueExpression stored for the specified name (if any), respecting any property aliases.

Overrides:
getValueExpression in class Field
Parameters:
name - Name of value binding expression to retrieve

setValueExpression

public void setValueExpression(java.lang.String name,
                               javax.el.ValueExpression binding)

Set the ValueExpression stored for the specified name (if any), respecting any property aliases.

Overrides:
setValueExpression in class Field
Parameters:
name - Name of value binding to set
binding - ValueExpression to set, or null to remove

getText

public java.lang.Object getText()
Description copied from class: Field

Literal value to be rendered in this input field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds.

Overrides:
getText in class Field

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface javax.faces.component.ValueHolder
Overrides:
getValue in class Field

getPassword

public java.lang.Object getPassword()

Value binding. While no password data will be rendered on the client side, if this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds.


setPassword

public void setPassword(java.lang.Object password)

Literal value to be rendered in this input field. If this property is specified by a value binding expression, the corresponding value will be updated if validation succeeds.

See Also:
getPassword()

isSubmitForm

public boolean isSubmitForm()

Flag indicating whether pressing enter in this text field would allow browser to submit the enclosing form.


setSubmitForm

public void setSubmitForm(boolean submitForm)

Flag indicating whether pressing enter in this text field would allow browser to submit the enclosing form.

See Also:
isSubmitForm()

isSubmitFormSet

public boolean isSubmitFormSet()

Returns true if submitForm attribute has been explicitely set, either through binding, value expression, or programmatically. Returns false otherwise.


getValueAsString

public java.lang.String getValueAsString(javax.faces.context.FacesContext context)

Return the empty Srting to be rendered This is done in order to avoid sending secret password back to the client where it can be sniffed by viewing the source code of the page.
Sending masked string such as set of asterisks would have confused the issue further as it could create an impression that password is saved on the client in the field in some meaningful state, which in reality it will be not. Thus, the password field will be rendered empty after each page submit, prompting user ( or browser if such functionality is enabled ) to reenter password

Overrides:
getValueAsString in class HiddenField
Parameters:
context - FacesContext for the current request
Returns:
A String value of the component

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)
Restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class Field

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)
Save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class Field


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.