?
Solved

HOWTO: preserve whitespace in a JSP document

Posted on 2006-07-04
3
Medium Priority
?
1,289 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 702 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Summer 2017 Scholarship Winners have been announced!
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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