Expand my Community achievements bar.

SOLVED

Import library for use in JSPs

Avatar

Former Community Member

I am attempting to use the Jsoup library in my JSPs for one of my custom bundles. I've added the dependency to my pom.xml, however, I cannot seem to get the library to properly import it into my JSP file. When loading the page I receive the following error in the logs: Only a type can be imported. org.jsoup.Jsoup resolves to a package.

My JSP import looks like this:

<%@ page import="org.jsoup.Jsoup" %>

I know that I am importing the library properly in my JSP, however, AEM seems to think this is a package. I've also added the org.jsoup.* dependency to the bundle pom.xml like so:

<Export-Package> org.apache.commons.validator.*, org.jsoup.* </Export-Package>

however, this doesn't seem to work either. Any direction or resources for using libraries in JSPs would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

See this community article which is based on your topic jsoup.

http://helpx.adobe.com/experience-manager/using/html-parser-service.html.

Thanks,
Ratna Kumar.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

See this community article which is based on your topic jsoup.

http://helpx.adobe.com/experience-manager/using/html-parser-service.html.

Thanks,
Ratna Kumar.

Avatar

Level 9

Hello,

If you are adding a new library then make sure the bundle is available in system at runtime it means you have to deploy that bundle in osgi (system/console/bundles). adding dependency to pom.xml helps compilation not at runtime so you have to deploy this bundle explicitly.

 

Thanks

Pawan