Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!


2 Answers

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>
like image 127
Ramesh PVK Avatar answered Oct 19 '25 10:10

Ramesh PVK


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.

like image 23
Martin Gamulin Avatar answered Oct 19 '25 08:10

Martin Gamulin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!