tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24506] New: - New line elimination at end of directives
Date Fri, 07 Nov 2003 17:46:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24506>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24506

New line elimination at end of directives

           Summary: New line elimination at end of directives
           Product: Tomcat 4
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mariuss@lightspeed.ca
                CC: mariuss@lightspeed.ca


JSP pages are a templating system which is using a meta language (the JSP
directives, declarations, scriplets and expressions) and literals from the
output language (HTML, XML or other text based fragments).

The JSP specification does not deal the new lines (or white space in general)
introduced by the meta language. These new lines are used for readability
reasons. In most cases the output language being HTML or XML extra empty lines
(or white space in general) does not have any semantical impact, so probably
this is the main reason why this issue was neglected.

In HTML/XML empty lines can be a problem in the following cases:
- JSP pages in general have may directives at the top of the page, this leads to
may empty lines at the top of the generated page, problems with this:
  - Internet Explorer may not properly detect the page type for XHTML pages
since it is doing a limited look ahead
(http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp)
  - viewing the source of these pages shows a blank screen first (trivial, but
how many developers over the years are dealing with this annoying fact?)
- the content of <pre> or <textarea> blocks in HTML
- the content of CDATA blocks in XML

In the case of other formats than HTML/XML (like plain text) the extra empty
lines can be a real problem.

Other templating languages are dealing with this very same issue:
http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping

While the proper solution would be in the specification, changing that is a
lengthy process (not to mention that it is almos impossible for an individual).
Since the spec is not saying anything about this issue and there is an obvious
problem I think that it would be proper to provide a limited fix in Tomcat.

The limited fix I am suggesting is as follows:
- for directives and declarations for which the end tag is followed only by
white space consider that white space and the new line as part of the directive
and don't output it
- for scriplets and expressions don't apply this

A switch or setting could be provided to enable this behaviour.

Cheers,
Marius

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message