How do I resolve a taglib?

I read someplace that I could code a taglib directive like
<%@ taglib prefix="foo" uri="foolib" %>

...and then use the ideSettings->externalResources screen to get "foolib"
resolve to a real file.

So far I can't seem to get the uri to resolve using this technique -- it
shows up red in the page.
BTW I haven't had any luck using something like uri="../WEB-INF/foolib.tld"
either.
Any suggestions?






5 comments
Comment actions Permalink

I use the external resources settings to add references to DTDs. For example I have an external resource pointing to the DTD of the Struts configuration file, so that I have autocompletion while editing it.

Resolving taglibs works another way.
Say you put foolib.tld in your /WEB-INF directory. Then you must enable web-app-support in the project properties. So when this WEB-INF is located in e:\projects\foo\, you add a web-app with its root directory pointing to e:\projects\foo\.
Now you put your web.xml in e:\projects\foo\WEB-INF. This one has to contain the following block:

foolib /WEB-INF/foolib.tld ]]>

Now you can reference the taglib in your JSPs in the manner you described and IDEA should provide the autocompletion facilities for it.

0
Comment actions Permalink

You should enable web applications support (try reading the corresponding
topic in help).

--
Best regards,
Mike Aizatsky.
-


JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

That worked for me.
I am running 662.
Alas, the help is where I read about assigning the external resource file in
the first place, but the bit about adding the directory as a web app was not
at all obvious. I went looking again to see if I had missed this, but no it
still seems to be missing.

"Mike Aizatsky" <mike@intellij.com> wrote in message
news:ap3ahk$efb$1@is.intellij.net...

You should enable web applications support (try reading the corresponding
topic in help).

>

--
Best regards,
Mike Aizatsky.
------------------------------
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"

>
>


0
Comment actions Permalink

and how do u enable the WEB APPLICATION...?

0
Comment actions Permalink

What about TLD definitions inside jar files? I don't know if this is standard, but it's sure a common feature in all servlet engines out there:
webwork WEB-INF/lib/webwork.jar ]]>Currently, IDEA doesn't support this. With this syntax, the TLD will be a file named META-INF/taglib.tld inside the jar file, so IDEA could simply look there if the <taglib-location> is defined as a jar file.

0

Please sign in to leave a comment.