public class Param extends UIParameter implements ParamHolder
The <o:param>
is a component that extends the standard UIParameter
to implement ValueHolder
and thus support a Converter
to convert the supplied value to string, if necessary.
You can use it the same way as <f:param>
, you only need to change f:
into
o:
to get the extra support for a Converter
by usual means via the converter
attribute of the tag, or the nested <f:converter>
tag, or just automatically if a converter is
already registered for the target class via @FacesConverter(forClass)
.
Also, if no value is specified, but children are present, then the encoded output of children will be returned as
param value. This is useful when you want to supply JSF components or HTML as parameter of an unescaped
<h:outputFormat>
. For example,
<h:outputFormat value="#{bundle.paragraph}" escape="false"> <o:param><h:link outcome="contact" value="#{bundle.contact}" /></o:param> </h:outputFormat>
with this bundle
paragraph = Please {0} for more information. contact = contact us
will result in the link being actually encoded as output format parameter value.
ParamHolder
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_TYPE |
COMPONENT_FAMILY
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
Constructor and Description |
---|
Param() |
Modifier and Type | Method and Description |
---|---|
void |
encodeChildren(FacesContext context) |
Converter |
getConverter() |
Object |
getLocalValue()
Returns the original, unconverted value of the parameter.
|
boolean |
getRendersChildren() |
Object |
getValue()
Returns the converted value of the parameter.
|
void |
setConverter(Converter converter) |
getFamily, getName, isDisable, setDisable, setName, setValue
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
setValue
public static final String COMPONENT_TYPE
public Converter getConverter()
getConverter
in interface ValueHolder
public void setConverter(Converter converter)
setConverter
in interface ValueHolder
public Object getLocalValue()
ParamHolder
getLocalValue
in interface ValueHolder
getLocalValue
in interface ParamHolder
public Object getValue()
ParamHolder
Application.createConverter(Class)
, passing the value's class, then return the result of
Converter.getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)
,
otherwise return the original value of the parameter.getValue
in interface ValueHolder
getValue
in interface ParamHolder
getValue
in class UIParameter
Converter.getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)
public boolean getRendersChildren()
getRendersChildren
in class UIComponentBase
public void encodeChildren(FacesContext context) throws IOException
encodeChildren
in class UIComponentBase
IOException
Copyright © 2012–2019 OmniFaces. All rights reserved.