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 form's action URL.
      Returns:
      Whether or not the request parameters should be encoded into the form's action URL.
    • setIncludeRequestParams

      public void setIncludeRequestParams(boolean includeRequestParams)
      Set whether or not the request parameters should be encoded into the form's action URL.
      Parameters:
      includeRequestParams - Whether or not the request parameters should be encoded into the form's action URL.