Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693602
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:23:48+00:00 2026-05-19T04:23:48+00:00

I found that the backing bean value displayed on the JSF page will collapse

  • 0

I found that the backing bean value displayed on the JSF page will collapse the white-space automatically .How can I make the value displayed do not collapse the white-space??

For example , I have a MBean which has a String variable test and assign the value

"test                  test"

, when I render it using <h1>${MBean.test}</h1> , it just give out test test which all the white-spaces in the middle collapse to a white-space only.

This behavior also happens if I display the ArrayList from the MBean in the table format using the <rich:dataTable> , all the white-spaces will be collapsed too.

Updated: I still think that it is specific to the JSF , because when I use
<h:inputText value="#{MBean.test}"/> , the rendered input text box will collapse all the white-spaces.How can I preserve all the white-spaces in this case??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:23:48+00:00Added an answer on May 19, 2026 at 4:23 am

    This is not specific to JSF. This is specific to HTML

    You can fix it by either putting it in a HTML <pre> element:

    <h1><pre>#{bean.text}</pre></h1>
    

    Or by applying CSS white-space: pre on the HTML element:

    h1 { 
        white-space: pre;
    }
    

    (as you see, it also occurs on your question here on Stackoverflow as well, since it also doesn’t preserve whitespace by white-space: pre)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do you get the request URL in a bean backing a JSF page?
I've found that on some occasions I can edit the source while debugging. Are
I have looked on FaceBook Developer page and found that it's possible to create
Here is JSF code: <h:inputText binding=#{bean.input} /> And here is a part of backing
I found that page: http://erikej.blogspot.com/2009/04/sql-compact-3rd-party-tools.html There are a lot of tools but it is
We’ve found that the unit tests we’ve written for our C#/C++ code have really
I have found that my HTML is, to be honest, very clunky. Small, simple
I have found that there is generally a singe type or namespace that takes
Whilst refactoring some legacy C++ code I found that I could potentially remove some
I've installed Ubuntu Server (8.04) into Parallels and found that the system time/clock ran

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.