• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Quoting and Escape Conventions

 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source: JSP Spec 2.0, Section JSP.1.6 (Page No. 1-35, In PDF File page no. is 71)

Quoting in EL Expressions
There is no special quoting mechanism within EL expressions; use a literal ‘${‘ if the literal ${ is desired and expressions are enabled for the page. For example, the evaluation of ${‘${‘} is ‘${‘. Note that ${‘}’} is legal, and simply evaluates to ‘}’.

Quoting in Scripting Elements

A literal %> is quoted by %\>

Quoting in Template Text

A literal <% is quoted by <\%
Only when the EL is enabled for a page (see Section JSP.3.3.2, “Deactivating EL Evaluation”), a literal $ can be quoted by \$. This is not required but is useful for quoting EL expressions.

Quoting in Attributes
Quotation is done consistently regardless of whether the attribute value is a literal or a request-time attribute expression. Quoting can be used in attribute values regardless of whether they are delimited using single or double quotes. It is only required as described below.
A ‘ is quoted as \’. This is required within a single quote-delimited attribute value.
A “ is quoted as \”. This is required within a double quote-delimited attribute value.
A \ is quoted as \\
Only when the EL is enabled for a page (see Section JSP.3.3.2, “Deactivating EL Evaluation”), a literal $ can be quoted by \$. This is not required but is useful for quoting EL expressions.
A %> is quoted as %\>
A <% is quoted as <\%
The entities ' and " are available to describe single and double quotes.


I am not able to understand what is convention for ?? For putting quotes (' or ") around attributes and escape values ??
Can some one explain these with examples or direct me to some valuable resource on net which can explain these with some good examples.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
me also looking forward to the replies

well yes I did't find any question in the exam related to Escaping convension. moreover it is not part of the objective, so you can relax at the exam point of view.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic