Search code examples
jsfjsf-2primefacesnewlineconfirm

Newline in <p:confirm message>


Is there a way to put a new line in the message of <p:confirm> component?

<p:confirm header="Confirmation"  
    message="Are you sure you want to continue? Bla bla bla" 
    icon="ui-icon-alert"  />

I would like to have "Bla bla bla" in a new line.


Solution

  • At the time I asked this question there was no escape option in confirm component but it was implemented on PrimeFaces 6.2 after this feature request.

    So now we can just do it this way:

    <p:confirm header="Confirmation"  
        escape="false"
        message="Are you sure you want to continue? &lt;br/&gt; Bla bla bla" 
        icon="ui-icon-alert"  />
    

    Alternatively, it's possible to use confirmDialog component as already suggested in other answers.