[MAGNOLIA-1401] Probably cms-taglib.tld and cms-util-taglib.tld should use real uris for there uris Created: 23/Feb/07  Updated: 13/Apr/07  Resolved: 13/Apr/07

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Chris Miner Assignee: Boris Kraft
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Currently the uri in the cms-taglib.tld is defined as:
<uri>cms-taglib</uri>

and in cms-util-taglib.tld it is

<uri>cms-util-taglib</uri>

How would it be to have something like this instead:

http://magnolia.info/cms-taglib

http://magnolia.info/cms-util-taglib

In my particular case it would mean not having to copy the two tlds into my web root in order to use them from a freemarker template. Besides it seems like a plain good idea.



 Comments   
Comment by Magnolia International [ 23/Feb/07 ]

It would be a good idea, but it would break compatibility with all existing templates out there.

So it's "only" to use the tags from freemarker templates that you need to copy the TLDs ? Do you have any idea why / can you elaborate? I remember I've had related issues in the past (non magnolia projects), but can't remember precisely right now. I don't really see how changing the uri of the taglibs would help ?

Comment by Chris Miner [ 28/Feb/07 ]

You can use jsp tag libs in your freemarker templates. Here's a couple of examples:

<#assign fmt=JspTaglibs["http://java.sun.com/jsp/jstl/fmt"]>
<#assign cms=JspTaglibs["/META-INF/cms-taglib.tld"]>

Then you can use them like:

<@fmt.message key="offer.general.originator.label" />
<@cms.editBar moveLabel="" deleteLabel="" paragraph="OfferGeneralDialogSimple" />

The freemarker TaglibFactory scrounges through your jars looking for tld files. The uri specified in each tld serves logically as the key. Keys can be any of the three forms allowed by the JSP specification: absolute URI, root relative URI and non-root relative URI.

see http://freemarker.sourceforge.net/docs/api/freemarker/ext/jsp/TaglibFactory.html

So when I try to access
<#assign cms=JspTaglibs["cms-taglib"]>

"cms-taglib" is treated as a non-root relative URI. It is resolved relative to my page (or template, I don't have the error message anymore)

"http://magnolia.info/cms-taglib" is understood as an absolute URI

"/META-INF/cms-taglib.tld" is understood as a root relative URI.

So as I understand the problem, the cms-taglib.tld declares its uri as a non root relative URI. It seems like it would make more sense if it declared an absolute URI.

Comment by Chris Miner [ 10/Apr/07 ]

This can be closed. It seems it is clearly a bug in freemarker. See

http://sourceforge.net/tracker/index.php?func=detail&aid=1670887&group_id=794&atid=100794

Generated at Mon Feb 12 03:26:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.