ServletWriter writer = null;
try {
-
- // Reset the temporary variable counter for the generator.
- JspUtil.resetTemporaryVariableName();
-
// Parse the file
ParserController parserCtl = new ParserController(ctxt, this);
pageNodes = parserCtl.parse(ctxt.getJspFile());
private static final String OPEN_EXPR_XML = "%=";
private static final String CLOSE_EXPR_XML = "%";
- private static int tempSequenceNumber = 0;
-
//private static ExpressionEvaluatorImpl expressionEvaluator
//= new ExpressionEvaluatorImpl();
// }
}
- /**
- * Resets the temporary variable name.
- * (not thread-safe)
- */
- public static void resetTemporaryVariableName() {
- tempSequenceNumber = 0;
- }
-
- /**
- * Generates a new temporary variable name.
- * (not thread-safe)
- */
- public static String nextTemporaryVariableName() {
- return Constants.TEMP_VARIABLE_NAME_PREFIX + (tempSequenceNumber++);
- }
-
public static String coerceToPrimitiveBoolean(String s,
boolean isNamedAttribute) {
if (isNamedAttribute) {
import javax.servlet.jsp.tagext.TryCatchFinally;
import javax.servlet.jsp.tagext.VariableInfo;
+import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
import org.apache.jasper.compiler.tagplugin.TagPluginContext;
import org.xml.sax.Attributes;
private boolean isBomPresent;
/*
+ * Sequence number for temporary variables.
+ */
+ private int tempSequenceNumber = 0;
+
+ /*
* Constructor.
*/
Root(Mark start, Node parent, boolean isXmlSyntax) {
public Root getParentRoot() {
return parentRoot;
}
+
+ /**
+ * Generates a new temporary variable name.
+ */
+ public String nextTemporaryVariableName() {
+ if (parentRoot == null) {
+ return Constants.TEMP_VARIABLE_NAME_PREFIX + (tempSequenceNumber++);
+ } else {
+ return parentRoot.nextTemporaryVariableName();
+ }
+
+ }
}
/**
*/
public String getTemporaryVariableName() {
if (temporaryVariableName == null) {
- temporaryVariableName = JspUtil.nextTemporaryVariableName();
+ temporaryVariableName = getRoot().nextTemporaryVariableName();
}
return temporaryVariableName;
}