Solved

HOWTO: preserve whitespace in a JSP document

Posted on 2006-07-04
3
1,276 Views
Last Modified: 2012-08-13
This is one of those, you know, or you don't know type of questions, not much of a change on just 'finding' it it seems.
First of, I'm talking about JSP documents, not pages, SUN has clarified this as a difference between xml-valid jsp pages and just plain old-school jsp pages. I'm talking about xml-valid here. In xml the general concensus is to strip all non-essential whitespace while processing a document. Now this is usually not a problem except that I have a desire to debug the output of my document and I would like it to remain human-readable.

From what I found out xml is supposed to have this preserved attribute that is supposed to be valid on all elements, 'xml:space="preserve"'. I'm saying supposed as eclipse is quite happily ignoring you if you add a space='preserve' to any given element, but starts slapping you on the wrist if you add xml:space. Tomcat really gets pissed with you for defining either of them.

So, with the default xml whitespace preservation out of the window, the question remain, how do I preserve whitespace in my JSP-document?
0
Comment
Question by:mreuring
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
ss_p earned 234 total points
ID: 17042115
you can write you own tag for preseving the whitespaces
0
 
LVL 17

Author Comment

by:mreuring
ID: 17048794
The content of the tag would still need to be parsed, how would I direct the parser to preserve the whitespace?
0
 
LVL 17

Author Comment

by:mreuring
ID: 17059059
Hmmm, for now I've resorted to using the jsp:text tag, which is far from preferable, but sorta does what you suggested.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bean mapper frameworks 5 59
Coldfusion 10 - JSP File Not Found - 404 Error 5 84
gZip compression filter 2 117
parse example 13 92
Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
Facing problems with you memory card? Cannot access your memory card? All stored data, images, videos are lost? If these are your questions...than this small article might help you out in retrieving your lost or inaccessible data.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

930 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

12 Experts available now in Live!

Get 1:1 Help Now