Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

JSP cannot resolve variables in Eclipse

kevinh6115
Level 2
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
Jörg_Hoh
Employee
Employee

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

kevinh6115
Level 2
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

Jörg_Hoh
Employee
Employee

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.

kevinh6115
Level 2
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