Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeFaces: Is there a way to put a hyperlink inside <p:message>

After a user add an item to the cart successfully, I'd like to display a message like Click here to continue shopping and Click here to view your cart using <p:message> or <p:growl>.

I tried to google with keywords like PrimeFaces how to put hyperlink into <p:message> but nothing meaningful showed up. Hence, I'd be very grateful if you could share with me how to do this or if it's even possible.

like image 421
Mr.J4mes Avatar asked Dec 13 '25 20:12

Mr.J4mes


1 Answers

According to the following blog post : FacesMessage Enhancements

You can use escape="false"

<p:message escape="false" />

context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
    "Sample warn message", "PrimeFaces is developed by 
    <strong>Chuck Norris!</strong>"));

Or

context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
    "Sample warn message", "Some Link
    <a href='http://www.w3schools.com/'>Visit W3Schools</a>"));

You could also take a look at this article by BalusC

Using HTML in JSF messages

like image 55
Daniel Avatar answered Dec 16 '25 09:12

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!