Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying blank spaces between two words

 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

At runtime I am suppose to set balnk spaces before some text which is to be displayed on page.

While constructing viewbean I am writing code like as below.


However when I display the text on my jsp it's getting displayed as follows

 runtime text
Can someone suggest me how to do this ?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you putting that bean text to your JSP page, Put that code.
 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the above message the blank space in the code are   which got converted to blank space
 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sagar,

I am using cut to print that text field on my jsp.

In may post the actuall code got converted to balnk spaces, that is not blank but the symbol used in html to put blank space.
 
Soniya Ahuja
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Waez,
The <cut> has attribute escapeXml who's default value is true. YOu need to set it explicitly as false. ONly then the blank spaces will be printed
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Multiple blank spaces will always be collapsed to a single space by the browsers. It has nothing to do with JSP or <cut> or even how many spaces there are in the HTML. That's just the way HTML works.

You should be adjusting the position of elements with CSS, not spaces.

If you really need multiple spaces, you'll need to encode them as non-breaking space entities: &nbsp;. The browser will not collapse multiple entities the way it will multiple whitespace characters.
[ July 30, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic