简体   繁体   中英

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.

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.

只需在PrimeFaces 3.3+中<p:messages>组件上设置escape="false" 即可

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"/>

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>")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM