Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are JSP expressions evaluated inside HTML comments of a JSP page?

Are JSP expressions evaluated inside HTML comments of a JSP page?

i.e What would server output in this case?

<!--
Jeremy <%="Flowers"%>
--> 

Will the expression be resolved or will it remain as an expression in the HTML comment

a)

<!--

Jeremy <%="Flowers"%>

-->

or b)

<!--

Jeremy Flowers

-->
like image 837
JGFMK Avatar asked Feb 20 '11 21:02

JGFMK


2 Answers

Yes, the expressions will be resolved. The JSP page doesn't even know it is writing in HTML format, so it doesn't interpret anything HTML-specific.

You can also write plain text using JSP, or JSON, or whatever you like.

like image 145
Roland Illig Avatar answered Sep 21 '22 12:09

Roland Illig


Those are html comments, not jsp comments. So, all jsp code inside is still evaluated.

There's also jsp-specific way to comment content: <%-– ... -–%>. Content inside won't be evaluated by the server and won't be passed to the browser. So, it acts as html comment too.

like image 39
Nikita Rybak Avatar answered Sep 18 '22 12:09

Nikita Rybak