This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
web deployment descriptor code (web.xml) = <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
standard.jar and jstl.jar are in place under WEB-INF
I know that we'll have to use JSTL 1.1 instead of 1.2 since we're tied to JSP 2.0 and that's fine.
Here are a few questions:
The "powers that be" may not allow an update to the web.xml. Will the current 2.3 reference above work for JSTL 1.2 and EL?
The "powers that be" may also not allow a direct reference to sun for the tlds, so we'd have to actually place them in our WEB-INF folder (which is fine). If we do this, do we have to update the web.xml with references to them or is that no longer necessary with this version?
The "powers that be" may also not allow a direct reference to sun for the tlds
You are referring to the uri to import the tag library?: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
It doesn't actually reference the tld from sun.
Sure it looks like a URL, but its not. Go ahead - try it in your browser. You will find it now directs you to an oracle page about JSTL, not to the tld itself.
It is actually a URI, which is something related, but different.
Basically that uri is referring (indirectly) to the tld bundled with jstl. The container is implicitly defining tag library URIs based upon tld files it finds bundled in jars in the WEB-INF/lib directory.
If you take a look in the tld for jstl core library: c.tld (it's bundled in standard.jar under the META-INF folder)
you will see the following:
Note that last element: uri? Thats what it is matching the taglib entry against.
It doesn't need to access anything on the internet to do that.
All of the gory details can be found in the JSP specification. JSP7.3 is the relevant bit to show the powers that be. Particularly 7.3.1 and 7.3.4
The bottom line: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> does NOT make a direct reference to sun for the tlds.
regarding updating the web.xml file, there will be a few minor adjustments to web.xml other than just changing the declaration at the top.
For instance in the 2.4 schema, tag libraries get declared in a <jsp-config> sub-element rather than as top level elements themselves.
However as detailed above tag libraries can be imported implicitly from jar files, without having to be referenced from web.xml, so I prefer not to have <taglib> entries in web.xml in any case.
bryan nelson wrote:The "powers that be" may also not allow a direct reference to sun for the tlds, so we'd have to actually place them in our WEB-INF folder
Good lord, I missed this.
Do the "powers that be" know anything?
As Stefan points out, that's just a URI, it could be "fred" or "adksjfhdsaflgfjkdsghfjhdgsjkhfds".
Joined: Jun 16, 2003
Oh man. Do I have egg on my face.
Thanks so much for clearing up the URI reference. This is extremely helpful and good for our current purposes. Basically we'll be able to use JSTL 1.1 and EL even if I can't convince anyone to alter the web.xml. I tried using the
page directive with the current 2.3 DTD and it works great. So we can at least go that route if nothing else.
Thank you each for your time in this thread...and hopefully it will help out others as well.