Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Adding Taglibraries to a web app
Adding Taglibraries to a web app [message #191332] Wed, 11 April 2007 13:42 Go to next message
Eclipse User
Originally posted by: wknauf_NO_._INSIDE_hg-online.de

Hi everybody,

I have read several discussions here on how to add a taglib to a WTP webapp, and
I have heard many times that it is not required to add the TLD file to WEB-INF,
and that it is not required to add a <jsp-config>-element to web.xml.
Only required steps are:
a) add jar file to web-inf\lib
b) add this to the JSP page: <%@ taglib uri="http://java.sun.com/jstl/core"
prefix="c" %>

I found that this is not enough with the JSTL core library (1.2) and JBoss
4.2.0. This one looks for a tld with matching URI in the JAR file and finds
"c-1_0.tld", a really old 1.0 tld which does not allow EL attributes for e.g.
c:if tags.
This results in strange errors while running the app. WTP seems to be more smart
here and picks the proper tld ;-).

So, it does not harm to perform all 4 steps to include a taglib ;-).

I filed a JBoss bug report, let's see what will happen.
http://jira.jboss.org/jira/browse/JBAS-4315?page=all

Wolfgang
Re: Adding Taglibraries to a web app [message #191359 is a reply to message #191332] Wed, 11 April 2007 18:09 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
Wolfgang Knauf wrote:
> Hi everybody,
>
> I have read several discussions here on how to add a taglib to a WTP
> webapp, and I have heard many times that it is not required to add the
> TLD file to WEB-INF, and that it is not required to add a
> <jsp-config>-element to web.xml.
> Only required steps are:
> a) add jar file to web-inf\lib
> b) add this to the JSP page: <%@ taglib
> uri="http://java.sun.com/jstl/core" prefix="c" %>
>
> I found that this is not enough with the JSTL core library (1.2) and
> JBoss 4.2.0. This one looks for a tld with matching URI in the JAR file
> and finds "c-1_0.tld", a really old 1.0 tld which does not allow EL
> attributes for e.g. c:if tags.
> This results in strange errors while running the app. WTP seems to be
> more smart here and picks the proper tld ;-).
>
> So, it does not harm to perform all 4 steps to include a taglib ;-).

It sounds like you want to use the http://java.sun.com/jsp/jstl/core
URI instead to pick up the newer version.

--
Nitin Dahyabhai
Structured Source Editor


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: Adding Taglibraries to a web app [message #191375 is a reply to message #191359] Thu, 12 April 2007 08:39 Go to previous messageGo to next message
Eclipse User
Originally posted by: wknauf_NO_._INSIDE_hg-online.de

Ooops, you are right ! So it is not a JBoss bug, I just have overseen the small
"jsp" in the URI.

Thanks

Wolfgang

> It sounds like you want to use the http://java.sun.com/jsp/jstl/core URI
> instead to pick up the newer version.
>
> --
> Nitin Dahyabhai
> Structured Source Editor
Re: Adding Taglibraries to a web app [message #719985 is a reply to message #191375] Mon, 29 August 2011 15:52 Go to previous messageGo to next message
tico  is currently offline tico
Messages: 2
Registered: August 2011
Junior Member
..in addition to your question, is it feasible to add this tag library globally at the project level?
I have jsp's that are intended to be includes and so do not have tag-libraries referenced at page level. And so when these pages are opened in eclipse jsp-editor these tags are not recognized. Is there a solution other than adding tag library elements at the page level?

-Tico
Re: Adding Taglibraries to a web app [message #720105 is a reply to message #719985] Mon, 29 August 2011 22:03 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
Aside from putting those taglib directives into a file declared as a matching jsp-prelude, no, at least there's no such mechanism yet (nor a clear RFE requesting a solution along those lines).

---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Install J2EE & Spring plugins
Next Topic:weird context location
Goto Forum:
  


Current Time: Fri Oct 24 08:36:37 GMT 2014

Powered by FUDForum. Page generated in 0.01780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software