- All Implemented Interfaces:
PartialStateHolder,StateHolder,TransientStateHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
The <o:conditionalComment> component renders a conditional comment. Conditional
comments are an IE specific feature which enables the developer to (out)comment blocks of HTML depending on whether
the client is using IE and if so even which version. They are often seen in combination with CSS stylesheets like so:
<!--[if lte IE 7]>
<link rel="stylesheet" href="ie6-ie7.css" />
<![endif]-->
However, Facelets renders the comment's contents HTML-escaped which makes it unusable.
<!--[if lte IE 7]>
<link rel="stylesheet" href="ie6-ie7.css" />
<![endif]-->
Also, if jakarta.faces.FACELETS_SKIP_COMMENTS context param is
set to true then it will even not be rendered at all. You would need to workaround this with an ugly
<h:outputText escape="false">.
<h:outputText
value="<!--[if lte IE 7]><link rel="stylesheet" href="ie6-ie7.css" /><![endif]-->"
escape="false" />
This component is designed to solve this problem.
<o:conditionalComment if="lte IE 7">
<link rel="stylesheet" href="ie6-ie7.css" />
</o:conditionalComment>
Note that you cannot use this with <h:outputStylesheet> as it would implicitly be relocated as
direct child of <h:head>.
- Author:
- Bauke Scholtz
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe component type, which is "org.omnifaces.component.output.ConditionalComment".Fields inherited from class org.omnifaces.component.output.OutputFamily
COMPONENT_FAMILYFields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidencodeBegin(FacesContext context) voidencodeEnd(FacesContext context) getIf()Returns the if condition.voidSets the if condition.Methods inherited from class org.omnifaces.component.output.OutputFamily
getFamily, getRendersChildrenMethods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeAll, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getPassThroughAttributes, getRenderer, getRendererType, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, visitTreeMethods inherited from class jakarta.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent
-
Field Details
-
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.output.ConditionalComment".- See Also:
-
-
Constructor Details
-
ConditionalComment
public ConditionalComment()
-
-
Method Details
-
encodeBegin
- Overrides:
encodeBeginin classUIComponentBase- Throws:
IllegalArgumentException- Whenifattribute is not specified.IOException
-
encodeEnd
- Overrides:
encodeEndin classUIComponentBase- Throws:
IOException
-
getIf
Returns the if condition.- Returns:
- The if condition.
-
setIf
Sets the if condition.- Parameters:
condition- The if condition.
-