Class SearchExpressionHandler

java.lang.Object
jakarta.faces.component.search.SearchExpressionHandler
Direct Known Subclasses:
SearchExpressionHandlerImpl, SearchExpressionHandlerWrapper

public abstract class SearchExpressionHandler extends Object
The SearchExpressionHandler is responsible for resolving search expression(s)

A search expression consists of either an identifier (which is matched exactly against the id property of a UIComponent, or a keyword (like @this or @form), or a series of such identifiers and keywords linked by the UINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext) character value. See SearchKeywordResolver for the list of supported keywords. The search algorithm must operate as follows, though alternate alogrithms may be used as long as the end result is the same:

  • Identify the UIComponent that will be the base for searching:
    • If the search expression begins with the separator character (called an "absolute" search expression), the base will be the UIViewRoot. The leading separator character will be stripped off, and the remainder of the search expression will be treated as a "relative" search expression as described below.
    • Otherwise, the SearchExpressionContext.getSource() will be used.
  • The search expression (possibly modified in the previous step) is now a "relative" search expression that will be used to locate the component (if any) based on the identifier and/or keywords:
    • The expression will be splitted by UINamingContainer.getSeparatorChar(jakarta.faces.context.FacesContext) into "commands". The commands will be resolved one by one. For the first command, the source component, like mentioned above, will be used to start the lookup. For all further commands, the previous resolved component, from the previous command, will be used the start the lookup.
    • If the command starts with the KEYWORD_PREFIX, then it is considered as a keyword and the SearchKeywordResolvers will be used the resolve the keyword.
    • Otherwise, if the command does not start with KEYWORD_PREFIX, then the component will be resolved based on the component ID.
Since:
2.3