• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

comment javascript embedded in a JSP file

 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic