Hi,
I am trying to achieve autocomplete feature on JSP in eclipse. I have followed the page http://dev.day.com/docs/en/cq/aem-how-tos/development/howto-develop-aem-projects-using-eclipse.html but still not able to accomplish. Here is a sample jsp I have prepared :
<%@ include file="/libs/foundation/global.jsp"%><% %><%@ page import="javax.jcr.*, org.apache.sling.api.resource.Resource, java.util.logging.Logger,java.util.Locale" %> <%@ taglib prefix="ex" uri="http://www.mercer.com/taglibs/mhrtaglib/1.0"%><% %><%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><% %><cq:setContentBundle/> <html> <head> <title>A sample custom tag</title> <cq:includeClientLib css="etc.designs.mercer.clientlibs"/> <!-- <script src="etc/designs/mercer/clientlibs/js/vendor/custom.modernizr.js" type="text/javascript"/> --> </head> <body> <ex:Hello/> <% Locale pageLocale = currentPage.getLanguage(false); %><br> <%= slingRequest.getResourceBundle("insights",pageLocale).getString("hello") %> <br> <br> <%= slingRequest.getResourceBundle("solutions",pageLocale).getString("hello") %> </body> </html>
These are the following errors and warning I am getting :
a) warning "Unknown tag (cq:setContentBundle)".
b) currentPage cannot be resolved
c) slingRequest cannot be resolved
d) warning Unknown tag (cq:includeClientLib).
Below given are the dependencies in my pom.xml file:
<dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>mercer-cq-package-bundle</artifactId> <version>${project.version}</version> </dependency> <!-- dependency defined by AnkitC::Start --> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.jcr-wrapper</artifactId> <!-- javax.jcr --> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> </dependency> <dependency> <groupId>com.day.cq</groupId> <artifactId>cq-commons</artifactId> <!-- com.day.cq.commons --> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-commons</artifactId> <!-- com.day.cq.wcm.commons --> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-api</artifactId> <!-- com.day.cq.wcm.api --> </dependency> <dependency> <groupId>com.day.commons</groupId> <artifactId>day-commons-jstl</artifactId> <!-- javax.servlet.jsp.jstl.core --> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-taglib</artifactId> <!-- com.day.cq.wcm.tags --> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId> <!-- org.apache.sling.scripting.jsp.taglib --> </dependency> <dependency> <groupId>com.adobe.granite</groupId> <artifactId>com.adobe.granite.xssprotection</artifactId> <!-- com.adobe.granite.xss --> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-core</artifactId> <!-- com.day.cq.wcm.core.components --> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <!-- org.apache.commons.lang3 --> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <!-- dependency defined by AnkitC::Start --> </dependencies>
Not sure, what exactly I am missing. Some jar files in my local.
Any help is appreciated.
Thanks in advance,
Ankit
Solved! Go to Solution.
What I sometimes do is to reference the global.jsp via ../../ instead of /libs/ etc.
Can you try this?
What I sometimes do is to reference the global.jsp via ../../ instead of /libs/ etc.
Can you try this?
This did the trick. Thanks for the response.
Ankit
What I sometimes do is to reference the global.jsp via ../../ instead of /libs/ etc.
Can you try this?
What I sometimes do is to reference the global.jsp via ../../ instead of /libs/ etc.
Can you try this?
This did the trick. Thanks for the response.
Ankit
Does /libs/foundation/global.jsp resolve?
In other words, do you have a copy of it in your project workspace?
Views
Replies
Total Likes
Please refer "http://dev.day.com/docs/en/cq/5-5/developing/developmenttools/developing_with_eclipse.html"
You should copy jar files from repository(http://localhost:4502/crx/repository/crx.default/libs/) into a folder in your system.
Now
In your project goto buildpath>>library>>Add External Jars add the jars
then you will not get the errors.
Views
Replies
Total Likes
Hi Bruce,
I just copied global.jsp from /libs/foundation. But it is still giving errors. However, I have one more thought going on in my mind. Since the APIs used here in this code are all CQ related and this is more of an environment related issue, and hence should work fine in your regular CQ environment. What is your take on this ?
Thanks,
Ankit
Views
Replies
Total Likes
If eclipse can find out /libs/foundation/global.jsp then jsp autocomplete should work. Some time path is not expected under jcr_root but at root project level. You can right click on your jsp file and select validate to find exact path where you want to put your global.jsp once placed right click again and select validate.
Hope this will help.
Yogesh
Views
Replies
Total Likes
Thanks for you response Yogesh. I just validated the jsp file and getting an error "Fragment "/apps/mercer/components/common/global.jsp" was not found at expected path /MMC/apps/
mercer/components/common/global.jsp"
Is there anyways I can fix this.
I am also getting error "currentPage cannot be resolved" on the below lines:
Locale pageLocale = currentPage.getLanguage(false);
slingRequest.getResourceBundle("insights",pageLocale).getString("hello")
Any help is appreciated.
Thanks.
Views
Replies
Total Likes
Worked like magic! Thanks mate.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies