tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: JSP quoting and escape conventions
Date Wed, 21 Feb 2001 20:26:28 GMT
William Au wrote:

> Yes, I see what you mean.  I guess it is a matter of what happen first.
> If the escape happens first, then the JSP
> <% String foo = "testing %\>"; %>
> would be translate to the following java code
> String foo = "testing %>";
> Then it would be valid java code.
> However, it seems to me in Tomcat, the translation happens first so the
> following
> invalid java code is generated:
> String foo = "testing %\>";

What is happening first is what *has* to happen first -- the JSP parser
sees the
"%\>" but recognizes (correctly) that this is not the end of the
scriptlet.  This
is exactly in accordance to the spec.

Therefore, all of the text between the "<%" and the "%>" is passed
through to the
language compiler for the scripting language (Java in this case),
by the JSP page compiler.  The uninterpreted code is not valid Java
syntax, and
therefore violates the JSP specification -- just the same as if you
forgot a
quote around the string literal, or omitted a required semicolon, or
made some
other error in Java syntax.

> Bill


View raw message