Can IDEA resolve JSP includes across nested directories?

(I realize the core of this question might be a FAQ, but all the responses I've seen point to documents & posts that describe how to setup a web module for a hello-world type of new project).

Assume all builds are done externally to IDEA, and we don't use the 'make' feature. Our JSPs are contained in nested directories in the src tree, but are all copied to the root of the war file during external deployment:




...and assume that this structure and build process cannot be changed.

Consider this top-level.jsp:

<%@ include file="my_include.jsp"%>
<bean:define id="ourStrutsForm" name="ourStrutsForm" type="com.mycompany.ui.OurStrutsForm" scope="request"/>
String someFormValue = ourStrutsForm.getSomeFormValue();

IDEA wants to assume that my_include.jsp is located in the same directory as the top-level.jsp, so it goes red with 'Cannot resolve symbol my_include.jsp.'

Ok, I can think of two things to try:

1. Configure a web resource directory to map "/" to point to the actual directory of my_include.jsp, which is


Ok, that might work, but what about when I want to get to the common_include.jsp file that lives here:


IDEA tells me that I can't map "/" to a higher level directory because "there is an existing web resource directory configured" "which already includes" my other directory. But if I map only common, then the my_include.jsp is no longer mapped to root "/", but instead would be found at "/html/my_include.jsp".

Ok, so that won't work. Next option:

2. Try to configure 'my_include.jsp' as an external resource. When I define 'my_include.jsp' (without quotes) as an external resource, pointing it to the actual file location in the source tree, the JSP still doesn't resolve. I would've expected it to, but since this is not really the intended use of external resources I'm not too surprised. I don't know if this is supposed to work or not, but even if it does it's not ideal, because it would mean that I'd have to hand-map every single file that is ever included in my project.

However this leaves me out of options. Does anyone know how to deal with a situation like this? Is there a bug somewhere here? All suggestions/tips are appreciated, thanks.

Please sign in to leave a comment.