Mark Thomas wrote: > Konstantin Kolinko wrote: >> In JSP 2.1 spec there is chapter >> JSP.1.6 Quoting and Escape Conventions >> - see "Quoting in Attributes" part there. >> >> Thus, IMHO, ${\'string literal\'} will be valid if used as the value for >> an attribute of custom tag. I've looked at this again and I don't believe this is valid, even if used as the value for a tag attribute.
>> The example from the spec >> <x:tag value="<%= \"Joe said 'hello'\" %>"/> >> becomes >> <x:tag value="${ \"Joe said 'hello'\" }"/> I think this should be: <x:tag value="${"Joe said 'hello'"}"/> My reasoning is as follows (quoting selectively from JSP.1.3.10) This section presents a simple EBNF grammar for the JSP syntax. The grammar is intended to provide a concise syntax overview and to resolve any syntax ambiguities present in this specification. Other sections may apply further restrictions to this syntax, for example to restrict what represents a valid attribute value for a page directive. In all other cases the grammar takes precedence in resolving syntax questions. So, starting with Attribute: Attribute ::= Name Eq ( ( ‘”<%=’ RTAttributeValueDouble ) | ( “‘<%=”RTAttributeValueSingle ) | ( ‘”’ AttributeValueDouble ) | ( “‘” AttributeValueSingle ) ) Then looking at attribute values that use double quotes: AttributeValueDouble::= ( QuotedChar - ‘”’ )* ( ‘”’ | <TRANSLATION_ERROR> ) QuotedChar I think is key to this. Note the use of \" and \' outside of ${...} but once inside ${...} the rules for ELExpression are followed. QuotedChar ::= ’'’ | ’"’ | ’\\’ | ‘\”’ | "\’" | ‘\$’ | ‘\#’ | ( ‘${‘ ELExpressionBody ) | ( ‘#{‘ ELExpressionBody ) | Char [ vc: QuotedDollarMatched ] ELExpressionBody ::= ELExpression ‘}’ | <TRANSLATION_ERROR> ELExpression ::= [See EL spec document, production Expression] If we follow ELExpression through to StringLiteral in section 1.19 of the EL spec, no additional quoting is defined. Expression ::= Expression1 ExpressionRest? Expression1 ::= Expression BinaryOp Expression | UnaryExpression UnaryExpression ::= UnaryOp UnaryExpression | Value Value ::= ValuePrefix (ValueSuffix)* ValuePrefix ::= Literal | NonLiteralValuePrefix Literal ::= BooleanLiteral | IntegerLiteral | FloatingPointLiteral | StringLiteral | NullLiteral StringLiteral ::= '([^'\]|\'|\\)*' | "([^”\]|\”|\\)*" i.e., a string of any characters enclosed by single or double quotes, where \ is used to escape ', ",and \. It is possible to use single quotes within double quotes, and vice versa, without escaping. I'm quite prepared to believe my logic above is wrong and that am I misreading the specs in some way. What do others think? Am I right or am I mis-reading the specs and if I am, where am I going wrong? Cheers, Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]