Revert r733072 after feedback from EG that original INVALID for https://issues.apache...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 12 Jan 2009 21:29:40 +0000 (21:29 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 12 Jan 2009 21:29:40 +0000 (21:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@733905 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java
java/org/apache/jasper/runtime/JspContextWrapper.java

index 495981d..8804f5e 100644 (file)
@@ -2032,6 +2032,9 @@ class Generator {
 
             n.setBeginJavaLine(out.getJavaLine());
 
+            // Copy virtual page scope of tag file to page scope of invoking
+            // page
+            out.printil("((org.apache.jasper.runtime.JspContextWrapper) this.jspContext).syncBeforeInvoke();");
             String varReaderAttr = n.getTextAttribute("varReader");
             String varAttr = n.getTextAttribute("var");
             if (varReaderAttr != null || varAttr != null) {
@@ -2045,11 +2048,6 @@ class Generator {
             out.print(toGetterMethod(n.getTextAttribute("fragment")));
             out.println(" != null) {");
             out.pushIndent();
-            // Copy virtual page scope of tag file to page scope of invoking
-            // page
-            out.printil("((org.apache.jasper.runtime.JspContextWrapper) this.jspContext).syncBeforeInvoke(");
-            out.print(toGetterMethod(n.getTextAttribute("fragment")));
-            out.println(".getJspContext());");
             out.printin(toGetterMethod(n.getTextAttribute("fragment")));
             out.println(".invoke(_jspx_sout);");
             out.popIndent();
index b4e2f6a..11a3b21 100644 (file)
@@ -336,16 +336,6 @@ public class JspContextWrapper extends PageContext implements VariableResolver {
        }
 
        /**
-     * Synchronize variables before fragment invokation
-     * @param jspContext The JspContext the variable should sync to.  This
-     *        is usually the context of the page where the fragment is. 
-     */
-    public void syncBeforeInvoke(JspContext jspContext) {
-        copyTagToPageScope(VariableInfo.NESTED, (PageContext)jspContext);
-        copyTagToPageScope(VariableInfo.AT_BEGIN, (PageContext)jspContext);
-    }
-
-    /**
         * Synchronize variables at end of tag file
         */
        public void syncEndTagFile() {
@@ -362,17 +352,6 @@ public class JspContextWrapper extends PageContext implements VariableResolver {
         *            variable scope (one of NESTED, AT_BEGIN, or AT_END)
         */
        private void copyTagToPageScope(int scope) {
-        copyTagToPageScope(scope,  invokingJspCtxt);
-    }
-
-       /**
-     * Copies the variables of the given scope from the virtual page scope of
-     * this JSP context wrapper to the page scope of the specified JSP context.
-     *
-     * @param scope variable scope (one of NESTED, AT_BEGIN, or AT_END)
-     * @param jspContext the target context
-     */
-    private void copyTagToPageScope(int scope, PageContext jspContext) {
                Iterator<String> iter = null;
 
                switch (scope) {
@@ -398,9 +377,9 @@ public class JspContextWrapper extends PageContext implements VariableResolver {
                        Object obj = getAttribute(varName);
                        varName = findAlias(varName);
                        if (obj != null) {
-                           jspContext.setAttribute(varName, obj);
+                               invokingJspCtxt.setAttribute(varName, obj);
                        } else {
-                           jspContext.removeAttribute(varName, PAGE_SCOPE);
+                               invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
                        }
                }
        }