public class ViewParam extends UIViewParameter
UIViewParameter
and provides a
stateless mode of operation and fixes the issue wherein null model values are converted to empty string parameters
in query string (e.g. when includeViewParams=true
).
The standard UIViewParameter implementation calls the model setter again after postback. This is not always desired when being bound to a view scoped bean and can lead to performance problems when combined with an expensive converter. To solve this, this component by default stores the submitted value as a component property instead of in the model (and thus in the view state in case the binding is to a view scoped bean).
The standard UIViewParameter implementation calls the converter regardless of whether the evaluated model value is
null
or not. As converters by specification return an empty string in case of null
value,
this is being added to the query string as an empty parameter. This is not desired.
You can use it the same way as <f:viewParam>
, you only need to change f:
to
o:
.
UIViewParameter.Reference
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_TYPE |
COMPONENT_FAMILY
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
Constructor and Description |
---|
ViewParam() |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getAttributes() |
String |
getStringValueFromModel(FacesContext context)
When there's a value expression and the evaluated model value is
null , then just return
null instead of delegating to default implementation which would return an empty string when a
converter is attached. |
String |
getSubmittedValue() |
boolean |
isRequired() |
void |
processDecodes(FacesContext context) |
void |
processValidators(FacesContext context) |
void |
setSubmittedValue(Object submittedValue) |
decode, encodeAll, getConvertedValue, getFamily, getName, getStringValue, isImmediate, setName, updateModel
addValidator, addValueChangeListener, clearInitialState, compareValues, getConverterMessage, getRequiredMessage, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isLocalValueSet, isValid, markInitialState, processUpdates, removeValidator, removeValueChangeListener, resetValue, restoreState, saveState, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, validate, validateValue
getConverter, getLocalValue, getValue, setConverter
addClientBehavior, addFacesListener, broadcast, encodeBegin, encodeChildren, encodeEnd, findComponent, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent, visitTree
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConverter, getLocalValue, getValue, setConverter
public static final String COMPONENT_TYPE
public void setSubmittedValue(Object submittedValue)
setSubmittedValue
in interface EditableValueHolder
setSubmittedValue
in class UIViewParameter
public String getSubmittedValue()
getSubmittedValue
in interface EditableValueHolder
getSubmittedValue
in class UIViewParameter
public boolean isRequired()
isRequired
in interface EditableValueHolder
isRequired
in class UIInput
public void processDecodes(FacesContext context)
processDecodes
in class UIInput
public void processValidators(FacesContext context)
processValidators
in class UIViewParameter
public Map<String,Object> getAttributes()
getAttributes
in class UIComponentBase
public String getStringValueFromModel(FacesContext context) throws ConverterException
null
, then just return
null
instead of delegating to default implementation which would return an empty string when a
converter is attached.getStringValueFromModel
in class UIViewParameter
ConverterException