JSP cannot resolve variables in Eclipse

Avatar

Avatar

kevinh6115

Avatar

kevinh6115

kevinh6115

22-07-2019

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

Replies

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K
Jörg_Hoh
Employee

22-07-2019

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

Avatar

kevinh6115

Avatar

kevinh6115

kevinh6115

22-07-2019

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

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K
Jörg_Hoh
Employee

22-07-2019

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

Avatar

kevinh6115

Avatar

kevinh6115

kevinh6115

22-07-2019

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