In my sample JSF application am using rich:dataTable in page to display data.
I have 2 header to display value in rich:dataTable like following
--------------------------------
| UserDetails | EmpoyeeDetails |
--------------------------------
In message resource bundle file having key and value like
usrDet = UserDetails empDet = EmpoyeeDetails
I need to display like User in one line and Details in next line of that particular header
----------------------
| User | Empoyee |
| Details | Details |
---------------------
How to add new line character in message bundle between words? I tried by adding Hexadecimal code, Numerical Code for \n like , \u000A but its not working for me! Any Idea?
JSF generates HTML. Newlines in HTML are not represented by the \n
character, but by the <br>
element.
In order to have the HTML client to interpret \n
too, you need to throw in CSS white-space: pre
or pre-wrap
:
key = Lorem ipsum.\nDolor sit amet.
<h:outputText value="#{bundle.key}" style="white-space: pre-wrap" />
Alternatively, use <br>
instead and have JSF unescape it. E.g.
key = Lorem ipsum.<br/>Dolor sit amet.
<h:outputText value="#{bundle.key}" escape="false" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With