Import library for use in JSPs | Community
Skip to main content
October 16, 2015
Solved

Import library for use in JSPs

  • October 16, 2015
  • 2 replies
  • 1730 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ratna_Kumar

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.

2 replies

Ratna_Kumar
Ratna_KumarAccepted solution
New Participant
October 16, 2015

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.

Pawan-Gupta
New Participant
October 16, 2015

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