Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How can I add JSP comments (instead of HTML comments) in Eclipse?
How can I add JSP comments (instead of HTML comments) in Eclipse? [message #991116] Mon, 17 December 2012 12:08 Go to next message
Paul Waite is currently offline Paul Waite
Messages: 2
Registered: December 2012
Junior Member
When editing JSP pages in Eclipse, I can comment out the current line or selected block with HTML comments using the keyboard shortcut CTRL+SHIFT+/:

<!-- -->


However, in JSP files, I usually want to use a JSP comment instead:

<%-- --%>


Is there a way to add these comments with a keyboard shortcut instead/as well?

A minimum of 25 shiny Stack Overflow rep points are available. See Stack Overflow question #13912025

[Updated on: Mon, 17 December 2012 16:31]

Report message to a moderator

Re: How can I add JSP comments (instead of HTML comments) in Eclipse? [message #991404 is a reply to message #991116] Tue, 18 December 2012 22:28 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick Sandonato
Messages: 126
Registered: July 2009
Senior Member
Hi Paul,

Unfortunately, there are no explicit keybindings for switching between the styles of comments used in a JSP file.

Instead, the keybinding for Ctrl+Shift+/ is overloaded in JSPs. If the selected region includes JSP-specific syntax (scriptlets, custom tags, etc.), Ctrl+Shift+/ inserts the JSP comment. So for example, <div><c:out value="test"></c:out></div> will be wrapped entirely in a JSP comment.

On the other hand, content that is not JSP-specific will use regular comments. For example, <div></div> will be wrapped in the typical HTML-style comment.

It changes once again to use Java-style comments, if only the Java content of a scriptlet is selected.
Re: How can I add JSP comments (instead of HTML comments) in Eclipse? [message #991880 is a reply to message #991404] Thu, 20 December 2012 12:05 Go to previous message
Paul Waite is currently offline Paul Waite
Messages: 2
Registered: December 2012
Junior Member
Cheers Nick, that makes sense. Many thanks for replying.
Previous Topic:Supressing / Removing problems from .js files programatically
Next Topic:Problems with Dynamic WebProject + J2EE Preview server on Juno
Goto Forum:
  


Current Time: Sun Sep 21 08:07:59 GMT 2014

Powered by FUDForum. Page generated in 0.02614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software