bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java
private void parseTemplateText(Node parent) throws JasperException {

	if (!reader.hasMoreInput())
	    return;

	CharArrayWriter ttext = new CharArrayWriter();
	// Output the first character
	int ch = reader.nextChar();
        if (ch == '\\') {
            reader.pushChar();
        } else {
            ttext.write(ch);
        }

	while (reader.hasMoreInput()) {
	    ch = reader.nextChar();
	    if (ch == '<') {
                reader.pushChar();
                break;
            }
	    else if( ch == '$' || ch == '#') {
		if (!reader.hasMoreInput()) {
		    ttext.write(ch);
		    break;
                }
		if (reader.nextChar() == '{') {
		    reader.pushChar();
		    reader.pushChar();
		    break;
		}
		ttext.write(ch);
		reader.pushChar();
		continue;
	    }
	    else if (ch == '\\') {
		if (!reader.hasMoreInput()) {
		    ttext.write('\\');
		    break;
		}
                char next = (char)reader.peekChar();
                // Looking for \% or \$
                // Note that this behavior can be altered by the attributes
                // el-ignored and deferred-syntax-allowed-as-literal and
                // similar attributes in a page directive.  However, since
                // the page direcitve may appear later in the same page, the
                // '\' will be regenerated in Generator.java.
                if (next == '%' || next == '$' || next == '#') {
                    ch = reader.nextChar();
                }
	    }
	    ttext.write(ch);
	}
	new Node.TemplateText(ttext.toString(), start, parent);
    }
private void parseTemplateText(Node parent) throws JasperException {

	if (!reader.hasMoreInput())
	    return;

	CharArrayWriter ttext = new CharArrayWriter();
	// Output the first character
	int ch = reader.nextChar();
        if (ch == '\\') {
            reader.pushChar();
        } else {
            ttext.write(ch);
        }

	while (reader.hasMoreInput()) {
	    ch = reader.nextChar();
	    if (ch == '<') {
                reader.pushChar();
                break;
            }
	    else if( ch == '$' || ch == '#') {
		if (!reader.hasMoreInput()) {
		    ttext.write(ch);
		    break;
                }
		if (reader.nextChar() == '{') {
		    reader.pushChar();
		    reader.pushChar();
		    break;
		}
		ttext.write(ch);
		reader.pushChar();
		continue;
	    }
	    else if (ch == '\\') {
		if (!reader.hasMoreInput()) {
		    ttext.write('\\');
		    break;
		}
                char next = (char)reader.peekChar();
                // Looking for \% or \$
                // Note that this behavior can be altered by the attributes
                // el-ignored and deferred-syntax-allowed-as-literal and
                // similar attributes in a page directive.  However, since
                // the page direcitve may appear later in the same page, the
                // '\' will be regenerated in Generator.java.
                if (next == '%' || next == '$' || next == '#') {
                    ch = reader.nextChar();
                }
	    }
	    ttext.write(ch);
	}
	new Node.TemplateText(ttext.toString(), start, parent);
    }
/*
Parse for a template text string until '<' or "${" is encountered,
recognizing escape sequences "\%" ,"\$", and \#.