Solved

HOWTO: preserve whitespace in a JSP document

Posted on 2006-07-04
3
1,282 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
[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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
Multi-threading long-running processes can have a significant increase in overall performance and drastically decrease over time it takes for a process to complete. Unfortunately, not all applications support native multi-threading, some by design a…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

707 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