user818700
user818700

Reputation:

Liferay Taglib import not working in JSP

I'm having trouble importing the liferay taglibs in one of my JSP pages, no idea what I'm doing wrong. I did the exact same thing in previous projects, but now for some reason it's not working.

My code to import:

<%@ taglib uri="http://liferay.com/tld.ui" prefix="liferay-ui" %>

The syntax error I'm getting:

The absolute uri: http://liferay.com/tld.ui cannot be resolved in either web.xml or the jar files deployed with this application

I tried to google this problem quite extensively, but to no avail. The horrible documentation (or lack thereof) for liferay is also not a big help at all.

Thanks in advance for any help!

Upvotes: 4

Views: 6095

Answers (3)

Martin Gamulin
Martin Gamulin

Reputation: 3865

it is not

<%@ taglib uri="http://liferay.com/tld.ui" prefix="liferay-ui" %>

it should be

<%@ taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %>

notice that "tld.ui" must be "tld/ui".

liferay-ui.tld comes from util-taglib.jar that liferay adds to your WEB-INF/lib during hot deploy.

No entries to your web.xml are needed.

Upvotes: 2

Ramesh PVK
Ramesh PVK

Reputation: 15456

The taglib URI gets resolved from the following places(in the order):

  1. If the container is Java EE platform compliant, the tag libraries that are part of the Java EE platform. This currently includes JSTL and JSF Tag Library libraries.
  2. Taglib Map in web.xml, the web.xml can include an explicit map of URI's and TLD's respource paths.
  3. TLDs in JAR files in WEB-INF/lib and TLDs under WEB-INF
  4. TLD's supported by Container

In you case, check the following cases: 1) If jar file realted to liferay exists in WEB-INF/lib containing a TLD in jar/META-INF which will be defined with http://liferay.com/tld.ui URI. 2) If there is not jar file and the liferay-ui.tld exists outside the jar file, add the URI mapping entrey in your web.xml like below:

<taglib>
    <taglib-uri>http://liferay.com/tld/ui</taglib-uri>
    <taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
</taglib>

Upvotes: 8

soulcheck
soulcheck

Reputation: 36777

You probably need to include taglib declaration in your web.xml.

    <taglib>
        <taglib-uri>http://liferay.com/tld/ui</taglib-uri>
        <taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
    </taglib>

Upvotes: 1

Related Questions