• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jstl tlds entry in web.xml

 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you change it from something valid to something that's invalid? Makes no sense.
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic