wood burning stoves*
The moose likes JSF and the fly likes Problem Related with JSF display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem Related with JSF display" Watch "Problem Related with JSF display" New topic
Author

Problem Related with JSF display

sam oo
Greenhorn

Joined: Apr 06, 2011
Posts: 2
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

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
sam oo
Greenhorn

Joined: Apr 06, 2011
Posts: 2
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

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem Related with JSF display
 
Similar Threads
disabled issue for inputtext
How to provide whitespace in JSF ?
Add component on a button click
Controls getting messed/switched up between pages - outputText and inputText
how to add a row dynamically in panel grid by clicking on command button using jsf