code: protected void restoreScriptingVars(JavaCodeWriter tagWriter, int scope) {
          if (nestingLevel == 0) {
              return;
          }
  
          TagVariableInfo[] tagVarInfos = ti.getTagVariableInfos();
          VariableInfo[] varInfos = ti.getVariableInfo(collectedTagData.getTagData());
          
          if (varInfos == null)
              varInfos = new VariableInfo[0];
              
          if ((varInfos.length == 0) && (tagVarInfos.length == 0)) {
              return;
          }
  
          if (varInfos.length > 0) {
              for (int i = 0; i < varInfos.length; i++) {
                  if (varInfos[i].getScope() != scope)
                      continue;
                  if (containsVariableInfo(getScriptingVars(scope), varInfos[i])) {
                      continue;
                  }
                  String varName = varInfos[i].getVarName();
                  String tmpVarName = "_jspx_" + varName + "_" + nestingLevel;
                  tagWriter.print(varName);
                  tagWriter.print(" = ");
                  tagWriter.print(tmpVarName);
                  tagWriter.println(";");
              }
          }
          else {
              for (int i = 0; i < tagVarInfos.length; i++) {
                  if (tagVarInfos[i].getScope() != scope)
                      continue;
                  if (containsTagVariableInfo(getScriptingVars(scope),tagVarInfos[i])) {
                      continue;
                  }
                  String varName = tagVarInfos[i].getNameGiven();
                  if (varName == null) {
                      varName = collectedTagData.getTagData().getAttributeString(tagVarInfos[i].getNameFromAttribute());
                  }
                  else if (tagVarInfos[i].getNameFromAttribute() != null) {
                      // alias
                      continue;
                  }
                  String tmpVarName = "_jspx_" + varName + "_" + nestingLevel;
                  tagWriter.print(varName);
                  tagWriter.print(" = ");
                  tagWriter.print(tmpVarName);
                  tagWriter.println(";");
              }
          }
      }
docs: /*
  This method is called as part of the custom tag's end element.
  
  If the given custom tag has a custom nesting level greater than 0,
  restore its scripting variables to their original values that were
  saved in the tag's start element.