Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a message similar to p:messages using PrimeFaces without adding to FacesContext?

I am using Primefaces 2.3.0 and JSF2.0.

I like the html output that Primefaces p:messages gives me. But I due to existing design, I would like to create the html without needing the to add the messages using FacesContext.getCurrentInstance().addMessage.

Essentially, I would like to do something like this:

<p:messages value="test"/>

I realize probably would not use p:messages but an existing tags that just outputs something very similar to what p:messages outputs.

I am hoping there is maybe another component that p:messages is using.

Thanks for any ideas.

like image 995
JeffJak Avatar asked Nov 05 '12 20:11

JeffJak


1 Answers

The most minimalistic example I've found that looks exactly the same using my theme is:

<div class="ui-message-error">
    <span class="ui-message-error-icon"/>
    <span class="ui-message-error-detail">test</span>
</div>

I've removed classes ui-widget ui-corner-all from div, because I don't use rounded corners etc., but if it makes a difference in your case, well, the example would be a bit longer.

like image 82
Danubian Sailor Avatar answered Oct 03 '22 10:10

Danubian Sailor