title: Command link with "copy to clipboard" function jsf primefaces
body: <p>So as in the picture i have a share, save and apply button.
  <a href="https://i.stack.imgur.com/brmrI.png" rel="nofollow noreferrer">image</a></p>
  <p>i've read some articles about the copy to clipboard but it seems only works with a button (?), As what i used is a command link ,since i wanted a transparent button so i used a command link instead of command button(i read this from another articles).</p>
  <p>This is my xhtml file</p>
  <pre><code>&lt;h:commandLink id=&quot;share&quot;&gt;
  &lt;i class=&quot;fa fa-share-alt&quot; style=&quot;color: black&quot;/&gt;
  &lt;h:outputText value=&quot;&amp;#160;Share&quot; escape=&quot;false&quot; style=&quot;color: black;&quot;/&gt;
  &lt;/h:commandLink&gt;
  &lt;pe:clipboard id=&quot;clipboardbtn&quot; trigger=&quot;share&quot; action=&quot;copy&quot; text=&quot;http://localhost:8082/index.xhtml&quot;&gt;
  &lt;p:ajax event=&quot;success&quot; listener=&quot;#{clipboardController.successListener}&quot; /&gt;
  &lt;p:ajax event=&quot;error&quot; listener=&quot;#{clipboardController.errorListener}&quot; /&gt;
  &lt;/pe:clipboard&gt;
  </code></pre>
  <p>This is my controller</p>
  <pre><code>public void successListener(final ClipboardSuccessEvent successEvent) {
          final FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, &quot;Success&quot;,
                  &quot;Component id: &quot; + successEvent.getComponent().getId() + &quot; Action: &quot; + successEvent.getAction()
                  + &quot; Text: &quot; + successEvent.getText());
          FacesContext.getCurrentInstance().addMessage(null, msg);
      }
  </code></pre>
  <p>I'm really stuck in here and the references for this isn't that much :(
  I've been searching everywhere but only found about that commandbutton references not commandlink, but i needed to use a commandlink since i wanted the UI like in the image i've attahced above.</p>