Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Commenting Comments  RSS feed

 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any way to comment out JSP comments?
This would come in hands if we need to
comment out contents which has comments.

Please check the below illustration:



Please comment.

Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37242
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
I don't see the exclamation marks in those comments, but I'll assume they are there.

No, there is not a way to comment out JSP comments. You just have to put the comments before and after. A bit of a pain, I know.

But it's just like commenting out /* */ comments in Java.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37242
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
But it's just like commenting out /* */ comments in Java.

To clarify, it's like Java comments in that you can't comment them out.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne is mistaken about the exclamation points (she may be thinking about HTML comments) but is correct in that you cannot nest JSP comments.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37242
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Jeanne is mistaken about the exclamation points (she may be thinking about HTML comments)

I was actually thinking of XML comments - although they are the same.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah yes. The difference between HTML/XML comments ("markup comments" if you will) and JSP comments (delimited via <%-- and --%>) is that the JSP translator does not recognize the former as comments and treats them as template text, while the latter are treated as comments in the JSP source.
[ December 28, 2005: Message edited by: Bear Bibeault ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

while the latter are treated as comments in the JSP source.


and are stripped out of JSP Source.

JSP Page


Translated JSP page code
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!