T
- The type of the value.public class Param<T> extends UIParameter implements ParamHolder<T>
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<T> |
getConverter()
Returns the converter, if any.
|
T |
getLocalValue()
Returns the original, unconverted value of the parameter.
|
boolean |
getRendersChildren() |
String |
getValue()
Returns the value of the parameter as
String . |
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<T> getConverter()
ParamHolder
getConverter
in interface ValueHolder
getConverter
in interface ParamHolder<T>
public void setConverter(Converter converter)
setConverter
in interface ValueHolder
public T getLocalValue()
ParamHolder
getLocalValue
in interface ValueHolder
getLocalValue
in interface ParamHolder<T>
ClassCastException
- When actual value is not T
.public String getValue()
ParamHolder
String
. If the converter is set, or if any converter is available by
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 Object.toString()
of the value.getValue
in interface ValueHolder
getValue
in interface ParamHolder<T>
getValue
in class UIParameter
String
.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–2020 OmniFaces. All rights reserved.