Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to display a string with empty characters in jsp?

Posted on 2009-05-19
2
Medium Priority
?
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 140 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes Administrators rights are not enough. These cases call for the SYSTEM account. The process in this article outlines the steps required to execute commands using the SYSTEM account.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

609 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