aspose file tools*
The moose likes JSP and the fly likes jstl tlds entry in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jstl tlds entry in web.xml" Watch "jstl tlds entry in web.xml" New topic
Author

jstl tlds entry in web.xml

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
Hi,

I have jstl jar files under App-inf/lib folder of Weblogic, and following simple code in test jsp works like charm WITHOUT any entry of core tld in web.xml
question is , is it not mandatory to define tld entry in web.xml?


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Praful Thakare wrote: is it not mandatory to define tld entry in web.xml?

No. It is not mandatory -- in fact, it is highly discouraged.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
Hey Bear, Nice to hear from you.

but if i change the uri from <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> to <%@ taglib uri="WEB-INF/tags/core" prefix="c" %> i get following error msg
Could not parse deployment descriptor: java.io.IOException: cannot resolve 'WEB-INF/tags/core' into a valid tag library
probably occurred due to an error in /lis/test.jsp
.

so now the question is, if not mention in web.xml does app server connect to java.sun.com/jstl/core?

-P

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Why would you change it from something valid to something that's invalid? Makes no sense.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
just trying to understand if uri is actually being referred at run time...since other tlds in my existing project have same value WEB-INF/tags/struts.tld for example..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

The URI is not a URL, it is just a name. The fact that it has the same format as a URL does not mean that it addresses anything.

The URI for a TLD is defined within the TLD itself and the container uses that to match up the URI in the taglib directive to the TLD to which it refers. For poorly-formed TLDs that do not have a URI (bad practice), you specify the location of the TLD in relation to the context root.

The JSTL TLDs each have their published URIs and that's what should be used to address them.

For some reason, some people feel the need to remove the TLD files from the JSTL jar, and put them someplace where they can address them. Where this bizarre practice got root, I do not know.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
waoo, so you mean just having jstl.jar is enough, there is no need to copy the tld files under web-inf/tags?
I got instructions from following forum



How to Install JSTL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

The article is ancient and wrong. It may have been correct when it was written, but is no longer valid.

Do not extract the TLDs. Do not add anything to the web.xml. Just drop the jar file (or files, depending upon version) into WEB-INF/lib and that's it.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
hmm..may not valid for jstl 1.0.6 since i don't find any tld file in jstl.jar for this version, i tired deleting c.tld from web-inf and it fails.

Do you ever Sleep Bear?


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

For JSTL 1.0 (are you using Tomcat 4?) you need both jstl.jar and standard .jar. The TLD files are in the latter.

Sleep?
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
using weblogic 8.1 sp4, yes I have standard.jar let me try to put it under Apps-inf, for some reason jstl.jar needs to be there..

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jstl tlds entry in web.xml