[opencms-dev] Taglib configuration

Ernesto De Santis ernesto.desantis at colaborativa.net
Mon Sep 26 15:57:32 CEST 2005


Hi Joe

This is the standard way (but...):

---------------------------------------

A better solution is to bundle the tld WITH your jar file.
For an example, take a look at the JSTL and how that is bundled.

You have to
1 - declare a <uri> element in your tld file
eg from JSTL:

<taglib>
  <short-name>c</short-name>
  <uri>http://java.sun.com/jstl/core</uri>
...
  

2 - include the tld file in the /META-INF of the jar file
3 - import the taglib into your pages using the uri defined in the tld file.

This way, all you need is the jar file somewhere in the classpath
- No entries in web.xml
- No tld files lying around.

Much simpler don't you think?

Cheers,
evnafets

--------------------------------------

But..., this don't work for me in opencms. :(
I don't know for what. I try in another context, and work fine.

If you get the solution, let me know please.

The other way is:
- copy the .tld to WEB-INF folder
- edit the web.xml file adding this tag:

    <taglib>
        <taglib-uri>http://www.opencms.org/taglib/cms</taglib-uri>
        <taglib-location>/WEB-INF/opencms.tld</taglib-location>
    </taglib>

- in your jsp use the uri for the taglib location.

Bye,
Ernesto.


Regards,
Ernesto.


Joe Desbonnet escribió:

>I'm writing a small taglib for an OpenCms project which sends a query
>to a webservice and includes returned HTML.
>eg <gcs:listing query="classification='acc.bb'" template="myTemplate" />
>
>Right now the service location is hardcoded in the taglib jar file,
>which is bad. I would like to
>make this configurable. However it's not clear to me what's the best
>way of doing this. I want to keep my taglib code independent of
>OpenCms, so I really don't want to be importing packages from OpenCms.
>
>Any suggestions on what's the best way to configure a taglib this way?
>
>Thanks,
>Joe.
>
>
>_______________________________________________
>This mail is send to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>  
>

-- 
Ernesto De Santis - Colaborativa.net
La Plata, Argentina.
http://www.colaborativa.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050926/91e1e0c2/attachment.htm>


More information about the opencms-dev mailing list