New Line character in FacesMessage Jsf

I wants to display the error message like, "The following headers not avail

1.Name
2.Roll no

How can i show this using faces message in jsf?Please help me.

Upvotes: 8

Views: 15181

Answers (4)

Andrew
Andrew

Reputation: 1

Simply set escape="false" on the <p:messages> component in PrimeFaces 3.3+.

Upvotes: 6

vssk
vssk

Reputation: 465

Try this one:

new FacesMessage(FacesMessage.SEVERITY_ERROR,
                 "Title",
                 "<html>List:<ul><li> List item 1;</li><li> List item 2;</li><li> List item 3.</li></ul></html>")

Upvotes: 0

Mahammad Aziz Ajmeri
Mahammad Aziz Ajmeri

Reputation: 11

you can do it using tag. You need to render this outputText on submit event and then display message in . You have to change escape attribute to false and user tag in you message where you need break. So in above case take one, 2.Roll" escape="false" render="your validation"/>

Upvotes: 0

maple_shaft
maple_shaft

Reputation: 10463

Without implementing a bizarre hack using javascript and css or without implementing your own JSF messages custom component this is not possible.

You will need to create a new FacesMessage for each line.

Upvotes: 8

Related Questions