This has nothing to do with JSTL or EL specifically, but with the way JSP parses custom tags (JSTL or otherwise). If you use the double quotes as delimiters, using them within the value will boof up the parsing. Same reason that you need to escape quote characters in Javastring literals. [ March 01, 2008: Message edited by: Bear Bibeault ]
Originally posted by Timothy Stone: I see the logic... but cite this example from actual production code in a JSP:
Note the nested double quotes the JSP. Some template code uses the response/return of the static method. This hasn't "boof'd" on parsing. Is it a scriptlet v. EL/JSTL question then?
The <a> tag isn't a rendered tag. It's just template text.
You really have to think through WHY it's a problem in an evaluated taglib tag. Don't just say "Oh, it goofs up because it's a tag" and move on. Think why.
In an evaluated tag, the tag renderer has to collect all the attributes. If it sees that your attribute value begins with a double quote, it's going to assume that the next double quote marks the end of the attribute value. Same with if your opening character were a single quote, it expects the ending character to be a single quote.
Now, for a tag like the <a> tag it's just template text that doesn't get evaluated on the server side. Nothing on the server side is trying to harvest its attribute values.
The difference can seem confusing because to the untrained eye both are simply the same format - an attribute in a tag. However, there's a huge difference in this case between a template text tag that the server side ignores and a taglib tag that gets evaluated and rendered on the server side.