Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

JSP cannot resolve variables in Eclipse

Avatar

Level 2

Hi All,

I recently worked on an existing project in Eclipse. It looks like the JSPs cannot resolve the variables such as xssAPI, i18n, sling although <%@include file="/libs/granite/ui/global.jsp"%> is included in the JSPs and I can find these global variables are defined in global.jsp. See below.

In the pom.xml, I use the uber-jar

<dependency>

                <groupId>com.adobe.aem</groupId>

                <artifactId>uber-jar</artifactId>

                <version>6.3.0</version>

                <scope>provided</scope>

                <classifier>apis</classifier>

</dependency>

Do I miss something? How can I fix this issue? Of course, I can remove the red X by disabling JSP Syntax Check in Preferences -> Validations, but that is not what I want.

Thanks for the help,

Kevin

1796730_pastedImage_0.png

1796731_pastedImage_1.png

4 Replies

Avatar

Employee Advisor

You need to include these included JSPs in your IDE as well. I think I read once about how to do it, but that's been a while, and I don't have the reference anymore. You might want to think about migrating your overlay to HTL and Sling Models :-)

Jörg

Avatar

Level 2

Thanks, Joerg, for trying to help.

Could you explain more about "include these inclued JSPs in the IDE as well"? In each JSP that uses these variables, the first line is <%@include file="/libs/wcm/global.jsp"%>, so global.jsp is already includes in the JSPs. In my understanding, based on the maven dependence, The JSPs in Eclipse should be able to recognize these variables, right?

Thanks again,

Kevin

Avatar

Employee Advisor

No, the JSPs are not part of the AEM uber.jar. What you could do: Export the complete /libs path (probably you need much less, but just to be on the safe side), and place it somewhere on your local filesystem.

And then add the jcr:content/ to the build path of your Eclipse project (do not include it in your content package!!!); that should do the trick.

Avatar

Level 2

The maven building is ok. There is no error for JSPs when building and deploying, The built package that includes the JSPs can run well in the website. The issue just is it shows error flat - red X within Eclipse in the JSPs that use the variables.

BTW, how to add jcr:content to the build path? are you talking about java build path? I can see all the libs there. see the pic.

Thanks,

Kevin

1796913_pastedImage_0.png