Solved

How to display a string with empty characters in jsp?

Posted on 2009-05-19
2
442 Views
Last Modified: 2012-05-07
I am writing code to display a string which comes from a session on a jsp page..this string is 15 chars long and can have empty spaces in the beginning or the middle of the string..when i display the string..it omits the empty spaces from the beginning and the end...how can i preserve these empty places in the string when I display it on the JSP.
The string is coming in the correct format to jsp..when i print it up in the console...
<TR>

	<TD align = left>ID: <%= idString %><FONT color = "red">(<%= numd %>)</FONT>

	</TD>

</TR>

The string can be "01234ABCDEFGHIJ" or "       CDEF HIJ"

If the first string is given it is displayed as expected..problem is with the second string..please help me.

Open in new window

0
Comment
Question by:srafi78
2 Comments
 
LVL 26

Accepted Solution

by:
mrcoffee365 earned 35 total points
ID: 24427013
This is not a JSP problem, it's HTML.  If you want to display a string in an HTML page with spaces intact, you can
1) replace all the spaces with the non-breaking space character (which will turn into a space if I type it in -- ampersand nbsp semicolon)
2) wrap your string with the HTML tags <pre> and </pre>

and so on.
0
 
LVL 8

Author Closing Comment

by:srafi78
ID: 31583247
The first option worked for me..Thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
JspWriter.write() and JspWriter.print() 4 75
Jquery ajax file upload not working 11 143
Run the project 5 82
parse example 13 86
Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now