kinman      2002/06/12 13:19:32

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
  Log:
  - The generated method should return a boolean, to indicate that the
    rest of the page be skipped.
  
  Revision  Changes    Path
  1.26      +21 -9     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Generator.java    11 Jun 2002 23:16:34 -0000      1.25
  +++ Generator.java    12 Jun 2002 20:19:32 -0000      1.26
  @@ -462,6 +462,7 @@
   
        private ServletWriter out;
        private MethodsBuffer methodsBuffer;
  +     private int methodNesting;
   
        /**
         * Constructor.
  @@ -471,6 +472,7 @@
            this.methodsBuffer = methodsBuffer;
            handlerInfos = new Hashtable();
            tagVarNumbers = new Hashtable();
  +         methodNesting = 0;
        }
   
        /**
  @@ -569,7 +571,7 @@
            out.print  (attributeValue(n.getPage(), false));
            printParams(n);
            out.println(");");
  -         out.printil("return;");
  +         out.printil((methodNesting > 0)? "return true;": "return;");
            out.popIndent();
            out.printil("}");
   
  @@ -1013,14 +1015,18 @@
                String tagMethod = "_jspx_meth_" + baseVar;
   
                // Generate a call to this method
  -             out.printin(tagMethod);
  +             out.printin("if (");
  +             out.print(tagMethod);
                out.print("(");
                if (parent != null) {
                    out.print(parent);
                    out.print(", ");
                }
  -//           out.println("pageContext, _jspxState);");
  -             out.println("pageContext);");
  +//           out.println("pageContext, _jspxState)");
  +             out.println("pageContext))");
  +             out.pushIndent();
  +             out.printil((methodNesting > 0)? "return true;": "return;");
  +             out.popIndent();
   
                // Set up new buffer for the method
                outSave = out;
  @@ -1028,10 +1034,11 @@
                methodsBufferSave = methodsBuffer;
                methodsBuffer = new MethodsBuffer();
   
  +             methodNesting++;
                // Generate code for method declaration
                out.println();
                out.pushIndent();
  -             out.printin("private void ");
  +             out.printin("private boolean ");
                out.print(tagMethod);
                out.print("(");
                if (parent != null) {
  @@ -1074,10 +1081,15 @@
            if (n.isScriptless() && varInfos == null &&
                        (tagVarInfos == null || tagVarInfos.length == 0)) {
                // Generate end of method
  +             if (methodNesting > 0) {
  +                 out.printil("return false;");
  +             }
                out.popIndent();
                out.printil("}");
                out.popIndent();
   
  +             methodNesting--;
  +
                // Append any methods that got generated in the body to the
                // current buffer
                out.print(methodsBuffer.toString());
  @@ -1319,7 +1331,7 @@
            out.print(tagHandlerVar);
            out.println(".doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)");
            out.pushIndent();
  -         out.printil("return;");
  +         out.printil((methodNesting > 0)? "return true;": "return;");
            out.popIndent();
   
            // TryCatchFinally
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to