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

  • SEARCH
  • Home
  • 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 7805847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:20:33+00:00 2026-06-02T02:20:33+00:00

I have a web page that queries database dynamically to display data on the

  • 0

I have a web page that queries database dynamically to display data on the page, similar to database tool like Toad etc. (not even close of course :), example for illustration only).

The problem is data gets trimmed when displayed on the page. This is how I display data using JSF

<h:outputText value="#{record[columnIndex].toDisplayString()}" />

I believe it is about html rendering. What should I do? Write an html encoder? How? Help would be highly appreciated.

  • 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-06-02T02:20:34+00:00Added an answer on June 2, 2026 at 2:20 am

    The <h:outputText> doesn’t trim the value at all.

    Perhaps you’re talking about whitespace like leading/trailing spaces, tabs, newlines, carriage returns, etc in the value, which have by default totally no meaning in HTML markup. It just becomes part of the HTML source code, but not the HTML presentation. Newlines, for example, are in HTML to be represented by the <br> element, not by the \n character.

    If you’d like to preserve the whitespace in a HTML element node as it is in the HTML source code, then you need to set the parent HTML element’s CSS white-space property to pre in order to preserve it. If you’d like to wrap lines in block elements, then use pre-wrap.

    E.g.

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

    with

    .preformatted {
        white-space: pre-wrap;
    }
    

    An alternative is to convert the text to valid HTML markup yourself. E.g. replacing every occurrence of \n character by the <br/> string. You could use an EL function for this.

    See also:

    • Component to inject and interpret String with HTML code into JSF page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page that always needs to stay current. I do not
I have a java applet that queries an Oracle database for data. When run
I have web forms page that has 2 controls. A gridview and an associated
I have a web page that consists of a checkbox (parent) and on this
I have a web page that displays a list of documents stored on the
I have a web page that is intended to be loaded on a person's
I have a web page that uses cross page posting to post to a
I have a web page that doesnt fit screen in normal resolution, so I
I have a web page that links to another web application, which unfortunately only
I have a web page that uses three controls to allow a user to

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.