Class Param<T>
- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- jakarta.faces.component.UIParameter
-
- org.omnifaces.component.output.Param<T>
-
- Type Parameters:
T
- The type of the value.
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,ValueHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
,ParamHolder<T>
- Direct Known Subclasses:
PathParam
public class Param<T> extends UIParameter implements ParamHolder<T>
The
<o:param>
is a component that extends the standardUIParameter
to implementValueHolder
and thus support aConverter
to convert the supplied value to string, if necessary.You can use it the same way as
<f:param>
, you only need to changef:
intoo:
to get the extra support for aConverter
by usual means via theconverter
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 Faces 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.
- Since:
- 1.4
- Author:
- Bauke Scholtz
- See Also:
ParamHolder
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.output.Param".-
Fields inherited from class jakarta.faces.component.UIParameter
COMPONENT_FAMILY
-
Fields inherited from class jakarta.faces.component.UIComponent
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 Summary
Constructors Constructor Description Param()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 asString
.void
setConverter(Converter converter)
-
Methods inherited from class jakarta.faces.component.UIParameter
getFamily, getName, isDisable, setDisable, setName, setValue
-
Methods inherited from class jakarta.faces.component.UIComponentBase
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
-
Methods inherited from class jakarta.faces.component.UIComponent
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.omnifaces.component.ParamHolder
getName
-
Methods inherited from interface jakarta.faces.component.ValueHolder
setValue
-
-
-
-
Field Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The component type, which is "org.omnifaces.component.output.Param".- See Also:
- Constant Field Values
-
-
Method Detail
-
getConverter
public Converter<T> getConverter()
Description copied from interface:ParamHolder
Returns the converter, if any.- Specified by:
getConverter
in interfaceParamHolder<T>
- Specified by:
getConverter
in interfaceValueHolder
- Returns:
- The converter, if any.
-
setConverter
public void setConverter(Converter converter)
- Specified by:
setConverter
in interfaceValueHolder
-
getLocalValue
public T getLocalValue()
Description copied from interface:ParamHolder
Returns the original, unconverted value of the parameter.- Specified by:
getLocalValue
in interfaceParamHolder<T>
- Specified by:
getLocalValue
in interfaceValueHolder
- Returns:
- The original, unconverted value of the parameter.
- Throws:
ClassCastException
- When actual value is notT
.
-
getValue
public String getValue()
Description copied from interface:ParamHolder
Returns the value of the parameter asString
. If the converter is set, or if any converter is available byApplication.createConverter(Class)
, passing the value's class, then return the result ofConverter.getAsString(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent, Object)
, otherwise return theObject.toString()
of the value.- Specified by:
getValue
in interfaceParamHolder<T>
- Specified by:
getValue
in interfaceValueHolder
- Overrides:
getValue
in classUIParameter
- Returns:
- The value of the parameter as
String
. - See Also:
Converter.getAsString(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent, Object)
-
getRendersChildren
public boolean getRendersChildren()
- Overrides:
getRendersChildren
in classUIComponentBase
-
encodeChildren
public void encodeChildren(FacesContext context) throws IOException
- Overrides:
encodeChildren
in classUIComponentBase
- Throws:
IOException
-
-