I want to comment out some javascript code inside JSP file. for example,
If I want to comment out some javascript code within <script> section, I can use common javascript comment way like "/* .... */", can I use the JSP comment way like <%-- -%> ??
I know <%-- -%> is to comment JSP code, but can I use it to comment the javascript inside a JSP file ?
To the JSP engine, anything that's not a JSP directive or tag is simply template text. So it doesn't matter what you do within it as far as JSP is concerned. In other words, JSP could care less whether JavaScript is commented or not.
A possibly irrelevant consideration: anything in template text gets sent as page source. So any JavaScript, commented or not, is sent to the page. As commented out code should never be checked into production, this shouldn't be a problem. But if it is, JSP comments do not become part of template text.