JSP syntax highlighting in IntelliJ IDEA Community Edition

0.00 avg. rating (0% score) - 0 votes

By default, syntax highlighting for Java Server Page (JSP) does not work very well in IntelliJ IDEA Community Edition. Only a few HTML tags and CSS constructs are highlighted, while many Javascript contructs such as single line comments will just show up as normal text. HTML attributes are also not highlighted:

Screenshot 2026-06-28 223921

Interesting, if the JSP extension is removed from the JSP (Syntax Highlighting Only) type under Settings > Editor > File Types, syntax highlighting will suddenly become much better. Java codes, CSS and HTML are now correctly highlighted, for the most part:

Screenshot 2026-06-28 224309

This is the dialog where JSP syntax highlighting is configured for JSP. All file type have been removed from File Name Patterns:

Screenshot 2026-06-28 224005

Even JSTL construct such as <c:choose> or <c:when> are also properly highlighted. This feature is only officially available in the paid edition of IntelliJ IDEA:

Screenshot 2026-06-28 224747

At first I thought this was good enough for me. However, after a restart of the IDE, syntax highlighting once again became much more limited. Only strings and special characters were highlighted, with JSTL showing as normal text. I believe this is an IntelliJ bug:

Screenshot 2026-06-28 225013

I didn’t want to spend my hard earned money on the Ultimate edititon just for JSP syntax highlighting, so I decided to define my own file types for JSP, associating it with *.js?:

Screenshot 2026-06-28 225219

IntelliJ only allows four different keyword highlight colors, so I grouped the common JSP-related keywords into four categories:

  1. JSP Constructs
  2. Java Language
  3. HTML Markup
  4. JavaScript Code

I then configured these as Groups 1, 2, 3, and 4 in the dialog above. Since there was no dedicated space to add HTML comments like <!-- -->, I highlighted them separately instead. The result is the following editor screen, which is obviously not the best syntax highlighter down there, but definitely more than good enough for me:

Screenshot 2026-06-28 225809

Autocomplete is still limited to same-document word matching, which is better than nothing. Still, I am satisified with the results and will not purchase the Ultimate edition any time soon. The keyword list I used can be downloaded here for those who are interested.

See also
Enable syntax highlighting in Nano for Java Server Pages (JSP)

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>