Solved

HOWTO: preserve whitespace in a JSP document

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now