Applying <p:commandButton> style to <p:commandLink> because I basically need <p:commandButton target="_blank">

John Alexander Betts picture John Alexander Betts · Oct 10, 2013 · Viewed 12.1k times · Source

Does anyone know how to put the same styles from the commandbutton to all commandlinks?

I want that all links appear like this (overriding links styles and using the button styles):

A normal button: enter image description here

A hovered button: enter image description here

A pressed button: enter image description here

My current primefaces theme is start

Answer

BalusC picture BalusC · Oct 11, 2013

As per the comments, just stick to <p:commandButton> and use an alternate solution to solve the initial functional requirement of the need to open the PDF file download in a new window without explicitly setting the <h:form target> (which would affect all of form's command buttons/links).

<p:commandButton ... ajax="false" onclick="form.target='_blank'">

This ends up in less CSS pain.