Class Link

All Implemented Interfaces:
ClientBehaviorHolder, PartialStateHolder, StateHolder, TransientStateHolder, ValueHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

public class Link extends HtmlOutcomeTargetLink

The <o:link> is a component that extends the standard <h:link> and allows including the request query string parameters of the current URL into the link's target URL. Standard Faces <h:link> does not include any query string parameters which are not declared as view parameters. This is particularly useful if you expect some state in the target page and don't want to repeat <f|o:param> all over place.

You can use it the same way as <h:link>, you only need to change h: to o:.

Include request params

When you want to include request query string parameters of the current URL into the link's target URL, set the includeRequestParams attribute to true.

 <o:link value="Go to some page with same query string" outcome="some-page" includeRequestParams="true">
 
Since:
4.5
Author:
Bauke Scholtz
See Also:
  • Field Details

    • COMPONENT_TYPE

      public static final String COMPONENT_TYPE
      The component type, which is "org.omnifaces.component.output.Link".
      See Also:
  • Constructor Details

    • Link

      public Link()
  • Method Details

    • encodeBegin

      public void encodeBegin(FacesContext context) throws IOException
      Overrides:
      encodeBegin in class UIComponentBase
      Throws:
      IOException
    • isIncludeRequestParams

      public boolean isIncludeRequestParams()
      Returns whether or not the request parameters should be encoded into the target URL. Defaults to false.
      Returns:
      Whether or not the request parameters should be encoded into the target URL.
    • setIncludeRequestParams

      public void setIncludeRequestParams(boolean includeRequestParams)
      Sets whether or not the request parameters should be encoded into the target URL. Defaults to false.
      Parameters:
      includeRequestParams - Whether or not the request parameters should be encoded into the target URL.
    • getFragment

      public String getFragment()
      Returns the identifier of the page fragment which should be brought into focus when the target page is rendered. The value of this attribute is appended to the end of target URL following a hash (#) mark. This notation is part of the standard URL syntax.
      Returns:
      The page fragment identifier.
    • setFragment

      public void setFragment(String fragment)
      Sets the identifier of the page fragment which should be brought into focus when the target page is rendered. The value of this attribute is appended to the end of target URL following a hash (#) mark. This notation is part of the standard URL syntax.
      Parameters:
      fragment - The page fragment identifier.