Techniques to associate Java constants to Javascript files

Hello, I've always been a backend (pure java) programmer, but now I find myself working in the HTML, JSP and JavaScript more.  I am becoming frustrated by the fact that Intellij's Find Usages functionality can't help me when a String literal that infact represents a java constant is used in a xyz.js file.  I'm wondering if anyone has any good techniques to help "link" the usage to the constant.  For example I have a Java file named  It has a constant as defined below:

public class ComponentType {
public static final String FOO = "FOO";

Then I have a javascript file named bangMyHead.js which constains the following:

isFoo: function() {       return this._componentType === "FOO";     }

I am willing to adopt some type of inconvenient convention to help structure the code in a way that will help Intellij.  For example, the following will not work but if it did I would happily start doing it.  If I could resturcture bangMyHead.js as:

/** * @see com.acme.ComponentType#FOO */ var COMPONENT_TYPE_FOO = "FOO";

isFoo: function() {       return this._componentType === "FOO";     }

I'm tempted to make the files JSPs, but I'm told that will have a negative impact on performance by preventing caching.

Please sign in to leave a comment.