Closed glassfishrobot closed 4 years ago
@glassfishrobot Commented Reported by markt_asf
@glassfishrobot Commented markt_asf said: As I have been working through this on the Tomcat side I have reached the conclusion that both specs are correct but that some clarification would be extremely beneficial.
My understanding of the way the specs interact is as follows.
In standalone EL:
In a literal expression (i.e. outside of a valid $ {...} expression) '\${' is an escape for '${'.
expression) \ is only ever used to escape \ ' or "
In JSP:
The EL spec ONLY applies to the contents of valid EL expressions. i.e. what is found inside $ {...}
This means that outside of valid EL expessions, the appropriate escaping (template text, attribute value, XML template text) is applied and that the escape rules will change once inside the expression. Things get 'interesting' when you have an atribute value like:
Outside the ${...}
attribute escaping rules apply. Inside the $
{...} EL escaping rules apply. In particular care is needed to ensure that the attribute escpaing rules are not applied inside the ${...}
before the expression is processed.
Again, all of the above also applies to #
{...}
expressions.
@glassfishrobot Commented Was assigned to super_glassfish
@glassfishrobot Commented This issue was imported from java.net JIRA UEL-42
The JSP specification states that '\$' is an escape for '$' (and references its use for escaping what would otherwise be treated as EL). The EL specification states that '\${' is an escape for '${'.
Given that EL can be used within JSP there is a potential conflict here. Which escape definition is correct? The EL one or the JSP one?
It is possible to take the view that both are correct. When using EL in standard alone mode '\$' would be treated as a literal '\$' and '\${' would be treated as a literal '${'. When using EL in a JSP '\$' would be treated as a literal '$' and '\${' would be treated as a literal '$' followed by a literal '{' or '${'. i.e. the treatment of '\$' would depend on whether it was parsed as EL in standalone or as EL in a JSP.
The different treatment of '\$' and '\${' is confusing. It would be better to have a single, consistent approach across JSP and EL.
My personal preference is for '\${' to be an escape for a literal '${'.
If the view is taken that both specs are correct and the different behaviour between standalone EL and EL in a JSP is desirable then it would help enormously if some clarification (with examples) was added to the specs.
The above all applies equally to '#'.