Find Usage not working with JSPs?

I feel like I must be missing something obvious, but a lot of the cool Intellij Refactoring features don't seem to be working in JSPs for me.

In specific, my project has a bunch of JSPs that have code in them.  They are in a war.  That war depends on a number of jar that we build as well.  The war and all jars are in the same Maven project.  I have them all in the same Intellij project (gotten by importing the maven project).

I've been doing re-factoring in one of the jars.  I've found a few methods that are greyed out (normally indicating they are not being used).  I comment them out, and then when I do the maven build, I get errors when I try to compile the JSPs, because they were using this method.

After adding the method back, I went into the JSP, and cmd+click-ed the method.  It takes me to the right definition.  I then right-click on the method and do a "Find Usage", and it does not take me back to the JSP.

It has been a while since I've been on a project that had code in the JSPs, but I could have swore this worked in the past.  Am I remembering incorrectly?  Is there something I need to turn on?  Is there something I might have accidentally turned off?

I'm using 9.0.3 #IU-95.429

Comment actions Permalink

Find Usages will miss some references in JSP pages.  From JSPs Java reflection is often used to locate an object in a given context at runtime and Intellij does not statically resolve those references with Find Usages. There is a workaround. If you select the method in your class and choose Search/Find in Path with a file mask of *.jsp you will hit the references. You can't assume Find Usages will pick up all references in JSPs.


Comment actions Permalink

When I turned off searching by exact matches and case sensitivity, search seemed to work a lot better in JSPs.

Although, the Find Usages still eludes me, it is less important with Seach in Path working well.

Comment actions Permalink

This should work.
Make sure that all maven dependencies are imported into IDEA project


Please sign in to leave a comment.