1

How do I insert a tab in a jsf page?

<h:outputText class="text" value="#{BackingBean.line1}" />

This doesn't work:

String line1 = "Scale \t: " + vss.getScale();

Any idea?

Danijel
  • 8,198
  • 18
  • 69
  • 133
  • 1
    See http://stackoverflow.com/questions/1571648/html-tab-space-instead-of-multiple-nbsp – Adam Apr 19 '12 at 14:52

1 Answers1

2

Whitespace is in HTML by default not accounted as part of presentation. You'd need to use HTML elements like <br/> for a newline or <ul><li> for lists or <dl><dt><dd> for definitions. Most likely the <dl><dt><dd> is most suitable for you.

If you have a hard head in, you could always just set the CSS white-space property of the parent element to pre.

E.g.

<h:outputText ... styleClass="preformatted" />

(please note that the class attribtue is invalid. It should be styleClass)

with

.preformatted {
    white-space: pre;
}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555