Bug 31780 - .jspx produce one long line of HTML output
Summary: .jspx produce one long line of HTML output
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.29
Hardware: PC Windows XP
: P3 enhancement with 2 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-10-19 15:24 UTC by Firepica
Modified: 2005-02-04 09:32 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Firepica 2004-10-19 15:24:00 UTC
Hi, guys, 

There is a problem popped up, which is kinda serious for our project.

We decided to move all our jsps into jsp documents (.jspx). Everything works 
fine, but output of such a page is not pretty printed html (as we would expect), 
but one long line (no line breaks at all).

As result: it's absolutely not possible to debug pages (that's why I set 
severity to major).

We've done some research, options like "mappedfile" and "trimSpaces" do not 
help, because former prints only static template text on the next line, but 
surprisingly, we don't have a single static text in our pages (use Struts <bean:
message>, so everything is dynamic).

How to reproduce the problem: in tomcat distribution go to jsp 2.0 examples 
(http://localhost:8080/jsp-examples/jsp2/jspx/basic.jspx), when you execute it 
and look at the source, you'll see that it wraps only by static text.

If you consider this as a bug to fix (which I hope will happen ;) I think, maybe 
a new config option can be added to jasper section of web.xml of tomcat, where 
you can specify whether you want to get pretty printed html as result of .jspx 
or just default behaviour with one line.
Comment 1 Kin-Man Chung 2004-10-21 21:26:32 UTC
The spec says in XML syntax, white spaces between tags must be ignored.  So this
is at best an enchancement.  It may be possible to add an option to pretty print
the output, but that's a low priority task.

You can also insert a listener to do the pretty-printing.
Comment 2 Firepica 2004-10-22 10:02:04 UTC
With your permission I changed it to an enchancement. Hope entire community 
would benefit from it if it's implemented.
Comment 3 Yoav Shapira 2004-11-30 18:29:18 UTC
Kin-Man: how would you insert a listener?  I'm just personally curious...

OP: I don't think anyone feels like working on this at the moment, so the 
quickest way to get anything done is to post a patch yourself ;)
Comment 4 Yoav Shapira 2005-01-20 15:56:41 UTC
Not happening, I see.
Comment 5 Klaro 2005-02-04 18:32:47 UTC
I recently developed a servlet filter which does some beautifying of XML output
produced by a servler (e.g. the JSP servlet).

This filter may help reading xhtml code sent to the browser. As far as I see
this filter works fine, but it was not tested under production enviroments (yet!).