• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem Related with JSF display

 
sam oo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting issue somthing h:outputText and h:inputText both are displaying values but they are collapse the multiple whitespaces into single white space while displaying (when it will converted into html)

for that i tried with style="white-space:pre" but it also not working so i am adding & nbsp; in between strings
even i tried with <pre> tag in h:inputText but it's not working but it's working with h:outputText
String str="hi & nbsp jsf" and


while displaying it shows in input text box with value "hi & nbsp ;jsf" not "hi jsf" So, what should i have to do so that that it will display without "& nbsp;"


while displaying it shows in input text box with value "hi jsf" not "hi jsf" So, what should i have to do so that that it will display without " "

I don't want with escape="false" for displaying because at some place i need h:inputText. In h:inputText there is no option for escape attribute

any other permanent solution for white Space Issue
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Sam!

This isn't a JSF problem, it's an HTML problem. Even on non-java webspages, HTML will squeeze out spaces on the display. That's one of the reasons that the "&nbsp;" entity is so popular, although it's a poor way to do things.

"&nbsp;" is a sub-optimal solution for 2 reasons.

1. When it's simply a matter of layout, it's not a true spacing indicator, it's an actual character. For properly laying out pages, CSS is better.

2. The &nbsp; is not the same character as a space character.
 
sam oo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Welcome to the JavaRanch, Sam!

This isn't a JSF problem, it's an HTML problem. Even on non-java webspages, HTML will squeeze out spaces on the display. That's one of the reasons that the "&nbsp;" entity is so popular, although it's a poor way to do things.

"&nbsp;" is a sub-optimal solution for 2 reasons.

1. When it's simply a matter of layout, it's not a true spacing indicator, it's an actual character. For properly laying out pages, CSS is better.

2. The &nbsp; is not the same character as a space character.


I know it's a HTML Problem but i want a exact solution of this issue
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam oo wrote:

I know it's a HTML Problem but i want a exact solution of this issue


That's nice, but we are not a Code Mill. We provide suggestions for free, but if it's exact solutions you want from me, I'll give you a rate quote. I'm not cheap.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic