- Use the trim property and trim directive, which should be equivalent to Jasper...
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 8 Mar 2007 15:52:15 +0000 (15:52 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 8 Mar 2007 15:52:15 +0000 (15:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@516081 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/TextOptimizer.java

index a53866e..82df521 100644 (file)
@@ -29,6 +29,7 @@ public class TextOptimizer {
     static class TextCatVisitor extends Node.Visitor {
 
         private Options options;
+        private PageInfo pageInfo;
         private int textNodeCount = 0;
         private Node.TemplateText firstTextNode = null;
         private StringBuffer textBuffer;
@@ -36,6 +37,7 @@ public class TextOptimizer {
 
         public TextCatVisitor(Compiler compiler) {
             options = compiler.getCompilationContext().getOptions();
+            pageInfo = compiler.getPageInfo();
         }
 
         public void doVisit(Node n) throws JasperException {
@@ -70,8 +72,8 @@ public class TextOptimizer {
         }
 
         public void visit(Node.TemplateText n) throws JasperException {
-
-            if (options.getTrimSpaces() && n.isAllSpace()) {
+            if ((options.getTrimSpaces() || pageInfo.isTrimDirectiveWhitespaces()) 
+                    && n.isAllSpace()) {
                 n.setText(emptyText);
                 return;
             }