Costin,

>         > If those variable declaration problems are fixed, I'll release a new 
>         > 4.1.6 milestone as soon as I can fix the JNDI problems.
> 
>         Not yet...
> 
>         I attached the failed jsp.
> 
>         Costin
> 
>         [...]
>
>         <%@ page language="java" %>
>         <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> 
>         <logic:iterate id="a" name="foo" property="bar">
>         </logic:iterate>
> 
>         <logic:present name="b">
>         <logic:iterate id="a" name="foo" property="bar">
>         </logic:iterate>
>         </logic:present>


last and final attempt! :)
The attached patch should fix the last issue you brought up.

Since I am still waiting for my commit privileges, Kin-Man
has again volunteered to apply the patch. Thanks Kin-Man!


Jan

Executing ssh-askpass to query the password...
Warning: Remote host denied X11 forwarding, perhaps xauth program could not be run on 
the server side.
? build
? build.properties
cvs server: Diffing .
cvs server: Diffing doc
cvs server: Diffing src
cvs server: Diffing src/bin
cvs server: Diffing src/share
cvs server: Diffing src/share/org
cvs server: Diffing src/share/org/apache
cvs server: Diffing src/share/org/apache/jasper
cvs server: Diffing src/share/org/apache/jasper/compiler
Index: src/share/org/apache/jasper/compiler/Generator.java
===================================================================
RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
retrieving revision 1.32
diff -u -r1.32 Generator.java
--- src/share/org/apache/jasper/compiler/Generator.java 21 Jun 2002 00:59:56 -0000     
 1.32
+++ src/share/org/apache/jasper/compiler/Generator.java 21 Jun 2002 22:23:17 -0000
@@ -543,15 +543,6 @@
        private MethodsBuffer methodsBuffer;
        private int methodNesting;
 
-       /*
-        * Maps temporary scripting variable to parent of custom tag that
-        * declared it
-        */
-       private Hashtable tmpVars;
-
-       // Maps NESTED scripting var to parent of custom tag that declared it
-       private Hashtable nestedVars;
-
        /**
         * Constructor.
         */
@@ -561,8 +552,6 @@
            methodNesting = 0;
            handlerInfos = new Hashtable();
            tagVarNumbers = new Hashtable();
-           tmpVars = new Hashtable();
-           nestedVars = new Hashtable();
        }
 
        /**
@@ -1306,20 +1295,20 @@
            out.printin("/* ----  ");
            out.print(n.getName());
            out.println(" ---- */");
+           out.printil("{");
+           out.pushIndent();
 
             boolean implementsTryCatchFinally =
                 TryCatchFinally.class.isAssignableFrom(tagHandlerClass);
 
-           /*
-            * Declare variables where current contents of scripting variables
-            * will be temporarily saved
-            */
-           declareTemporaryScriptingVariables(n);
-
            // Declare scripting variables with NESTED scope
            declareNestedScriptingVariables(n);
 
-           // Save current value of scripting variables if required
+           /*
+            * Save current values of scripting variables, so that the 
+            * scripting variables may be synchronized without affecting their
+            * original values
+            */
            saveScriptingVariables(n);
 
            out.printin(tagHandlerClass.getName());
@@ -1464,6 +1453,8 @@
            syncScriptingVariables(n, VariableInfo.AT_END);
 
            restoreScriptingVariables(n);
+           out.popIndent();
+           out.printil("}");
 
            n.setEndJavaLine(out.getJavaLine());
        }
@@ -1502,14 +1493,10 @@
                        if ((varInfos[i].getScope() == VariableInfo.NESTED)
                                    && varInfos[i].getDeclare()) {
                            String name = varInfos[i].getVarName();
-                           Node parent = (Node) nestedVars.get(name);
-                           if (parent == null || parent != n.getParent()) {
-                               out.printin(varInfos[i].getClassName());
-                               out.print(" ");
-                               out.print(name);
-                               out.println(";");
-                               nestedVars.put(name, n.getParent());
-                           }
+                           out.printin(varInfos[i].getClassName());
+                           out.print(" ");
+                           out.print(name);
+                           out.println(";");
                        }
                    }
                } else {
@@ -1522,14 +1509,11 @@
                        if ((varInfos[i].getScope() == VariableInfo.NESTED)
                                    && varInfos[i].getDeclare()) {
                            String name = varInfos[i].getVarName();
-                           Node parent = (Node) nestedVars.get(name);
-                           if ((parent == null || parent != n.getParent())
-                                   && idAttr.equals(name)) {
+                           if (idAttr.equals(name)) {
                                out.printin(varInfos[i].getClassName());
                                out.print(" ");
                                out.print(name);
                                out.println(" = null;");
-                               nestedVars.put(name, n.getParent());
                                break;
                            }
                        }
@@ -1544,67 +1528,10 @@
                            name = n.getTagData().getAttributeString(
                                     tagVarInfos[i].getNameFromAttribute());
                        }
-                       Node parent = (Node) nestedVars.get(name);
-                       if ((parent == null) || (parent != n.getParent())) {
-                           out.printin(tagVarInfos[i].getClassName());
-                           out.print(" ");
-                           out.print(name);
-                           out.println(";");
-                           nestedVars.put(name, n.getParent());
-                       }
-                   }
-               }
-           }
-       }
-
-       /*
-        * This method is called as part of the custom tag's start element.
-        *
-        * If the given custom tag has a custom nesting level greater than 0,
-        * declare temporary variables where the current values of the tag's
-        * scripting variables may be saved, so these values may be restored
-        * in the tag's end element.
-        */
-       private void declareTemporaryScriptingVariables(Node.CustomTag n) {
-           if (n.getCustomNestingLevel() == 0) {
-               return;
-           }
-
-           TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
-           VariableInfo[] varInfos = n.getVariableInfos();
-           if ((varInfos == null) && (tagVarInfos == null)) {
-               return;
-           }
-
-           if (varInfos != null) {
-               for (int i=0; i<varInfos.length; i++) {
-                   String tmpVarName = "_jspx_" + varInfos[i].getVarName()
-                       + "_" + n.getCustomNestingLevel();
-                   Node parent = (Node) tmpVars.get(tmpVarName);
-                   if ((parent == null) || (parent != n.getParent())) {
-                       out.printin(varInfos[i].getClassName());
-                       out.print(" ");
-                       out.print(tmpVarName);
-                       out.println(";");
-                       tmpVars.put(tmpVarName, n.getParent());
-                   }
-               }
-           } else {
-               for (int i=0; i<tagVarInfos.length; i++) {
-                   String varName = tagVarInfos[i].getNameGiven();
-                   if (varName == null) {
-                       varName = n.getTagData().getAttributeString(
-                                       tagVarInfos[i].getNameFromAttribute());
-                   }
-                   String tmpVarName = "_jspx_" + varName + "_"
-                       + n.getCustomNestingLevel();
-                   Node parent = (Node) tmpVars.get(tmpVarName);
-                   if ((parent == null) || (parent != n.getParent())) {
                        out.printin(tagVarInfos[i].getClassName());
                        out.print(" ");
-                       out.print(tmpVarName);
+                       out.print(name);
                        out.println(";");
-                       tmpVars.put(tmpVarName, n.getParent());
                    }
                }
            }
@@ -1614,10 +1541,10 @@
         * This method is called as part of the custom tag's start element.
         *
         * If the given custom tag has a custom nesting level greater than 0,
-        * save the values of all its scripting variables to temporary
-        * variables, so the scripting variables may be synchronized
-        * without affecting the values they had at the tag's start element.
-        * Those values will be restored when the tag's end element is reached.
+        * save the current values of its scripting variables to 
+        * temporary variables, so those values may be restored in the tag's
+        * end element. This way, the scripting variables may be synchronized
+        * by the given tag without affecting their original values.
         */
        private void saveScriptingVariables(Node.CustomTag n) {
            if (n.getCustomNestingLevel() == 0) {
@@ -1635,7 +1562,9 @@
                    String varName = varInfos[i].getVarName();
                    String tmpVarName = "_jspx_" + varName + "_"
                        + n.getCustomNestingLevel();
-                   out.printin(tmpVarName);
+                   out.printin(varInfos[i].getClassName());
+                   out.print(" ");
+                   out.print(tmpVarName);
                    out.print(" = ");
                    out.print(varName);
                    out.println(";");
@@ -1645,11 +1574,13 @@
                    String varName = tagVarInfos[i].getNameGiven();
                    if (varName == null) {
                        varName = n.getTagData().getAttributeString(
-                                tagVarInfos[i].getNameFromAttribute());
+                                       tagVarInfos[i].getNameFromAttribute());
                    }
                    String tmpVarName = "_jspx_" + varName + "_"
                        + n.getCustomNestingLevel();
-                   out.printin(tmpVarName);
+                   out.printin(tagVarInfos[i].getClassName());
+                   out.print(" ");
+                   out.print(tmpVarName);
                    out.print(" = ");
                    out.print(varName);
                    out.println(";");
cvs server: Diffing src/share/org/apache/jasper/core
cvs server: Diffing src/share/org/apache/jasper/logging
cvs server: Diffing src/share/org/apache/jasper/resources
cvs server: Diffing src/share/org/apache/jasper/runtime
cvs server: Diffing src/share/org/apache/jasper/servlet
cvs server: Diffing src/share/org/apache/jasper/util
cvs server: Diffing src/share/org/apache/jasper/xmlparser

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

Reply via email to