Results 1 to 3 of 3
  1. #1
    thachun is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default How to display a String that contains more than one white spaces

    Hi all,

    I am facing a problem about displaying a String including more one white space at the middle in the Label form. Here is my line code in a JSP page:
    ...
    <c:out value="${profile.profileName}" />
    ...
    All of us knew that HTML rendering will automatically trim the white space. Therefore if in the database the profile name has 3 white spaces at the middle, then it will be trimmed 2 white spaces.

    However, if I encodes that string into "1&nbsp;&nbsp;&nbsp;2" and set escapeXml to false, then the displayed string will be correct.

    It seems that this attribute can help me out but unfortunately if user enters a value "&nbsp" for the Profile name field, then since I set escapeXml to false, a white space will be displayed instead of the value user entered.

    Is there any way to solve my issue?

    Thanks ahead for your help!

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    Can you place the c out tag inside a <pre> or a <div> tag with the CSS
    white-space : pre;

    (and then leave excapeXML to true)

  3. #3
    thachun is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default Thanks Travis

    I wonder whether you are working in Kofax :-). Right?

Similar Threads

  1. Need to display the jsp variable(String) into html?
    By Arivudai Nambi in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-25-2009, 06:44 PM
  2. display histogram that count white pixels
    By TamTam in forum Java 2D
    Replies: 6
    Last Post: 02-14-2009, 10:26 PM
  3. BufferStrategy and white rows of pixels
    By TobyLobster in forum Java 2D
    Replies: 2
    Last Post: 12-29-2008, 02:49 PM
  4. Cannot display a random string from .dat file
    By explosion242 in forum New To Java
    Replies: 2
    Last Post: 09-18-2008, 02:48 PM
  5. White Space Issue
    By sibythoma1984 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 04-22-2008, 01:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •