Example usage of CommandLink and Javascript in Primefaces

To open a url in a new tab or window using Javascript:
window.open(url,'_blank');
Whether it is a new tab or a new window, also depends on browser's setting.

To do some back end job first and then redirect to a new tab or window, for example, to save user's job and then preview in a new tab/window, we can do the following:
<p:commandLink value="Preview" 
actionListener="#{yourBean.yourActionListener}" 
oncomplete="window.open('your-url','_blank');" />

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...