2- <taglib> under <jsp-config> - It's related to the old version of spec. The new version of spec (for our exam) says that <taglib> is supposed to be under <web-app>.
Hope it help you!
cya!!
SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
Bhavna Jharbade
Ranch Hand
Joined: Sep 08, 2005
Posts: 69
posted
0
Hi Felipe
Can u please send me the link for new specifications.
1) In servlet specs SRV.13.2 they say: "The sub elements under web-app can be in an arbitrary order in this version of the specification."
2) The same pdf (servlet 2.4 spec) , lists on page 136 the child elements of <web-app> and there is no <taglib> (but there is a <jsp-config); instead, page 143: the <taglib> comes under the <jsp-config> element !
So if you have another references, Felipe, please argument...
Thank you Gab
[ April 09, 2006: Message edited by: Gab Buda ] [ April 09, 2006: Message edited by: Gab Buda ]
SCJP 1.4 (85%)<br />SCWCD 1.4 (94%)
Bhavna Jharbade
Ranch Hand
Joined: Sep 08, 2005
Posts: 69
posted
0
Hi Felipe,Gab and others
I too found the things mentioned by Gab....but when I saw Felipe's response
Gab is correct. The order of elements under the web.xml does not matter accroding to Servlet Spec 2.4. But the order of subelemnts under the main elements still important in this spec. That is, you can place <servlet> element anywhere in the web.xml. But <servlet-name> <servlet-class> should be in order.
The <taglib> element goes under <jsp-config>. But it is not required to declare taglibs using this tag as the container autosearch the .tld files in the directories specified in the spec.
(I'm new to this forum, this is my very first post,... soooo exited)
There are some cases when the order of web.xml elements influences the web app behaviors:
- listeners to servetContext,... are notified in the order in which they appear in the web.xml
- ServletFilters placed on a url-pattern process the (HttpServletRequest, HttpServletResponse) in the order in which the <filter-mapping> elements appears in the DD.
There are probably other examples.
It is a mistake to think you can solve any major problems just with potatoes.<br />--Douglas Adams
Narendra Dhande
Ranch Hand
Joined: Dec 04, 2004
Posts: 950
posted
0
Hi,
There are some cases when the order of web.xml elements influences the web app behaviors:
Yes, the placement of listener,filters ordering is important, in which sequence they executed. But this is if the same element type, and the ordering is done as per your application needs. If you place there in arbitary order it will not be error, but your application logic may not work as you desire.
Thanks
Steven Colley
Ranch Hand
Joined: Feb 18, 2005
Posts: 290
posted
0
Hi folks,
Yes, you are dead right. The order doe snot matters. Tks.
Originally posted by Felipe Pittella: Hi, again...
i got this from the same page:
"The container will look first in your DD to see if you have made any <taglib> entries, and if you have, it will use those o help construct the map."
Tks.
<taglib> entry is not mandatory in web.xml but you can define one or more <tablib> entries if necessary.
The precedence of taglib map is specified in section of JSP 2.0 spec:
The following order of precedence applies (from highest to lowest) when building the taglib map (see the following sections for details): 1. Taglib Map in web.xml 2. Implicit Map Entries from TLDs TLDs in JAR files in WEB-INF/lib TLDs under WEB-INF 3. Implicit Map Entries from the Container
JSP.7.3.3 Taglib Map in web.xml The web.xml file can include an explicit taglib map between URIs and TLD resource paths described using the taglib elements of the Web Application Deployment descriptor in WEB-INF/web.xml.
JSP.7.3.4 Implicit Map Entries from TLDs The taglib map described in web.xml is extended with new entries extracted from TLD files in the Web Application.
JSP.7.3.5 Implicit Map Entries from the Container The Container may also add additional entries to the taglib map. As in the previous case, the entries are only added for URIs that are not present in the map. Conceptually the entries correspond to TLD describing these tag libraries. These implicit map entries correspond to libraries that are known to the Container, who is responsible for providing their implementation, either through tag handlers, or via the mechanism described in Section JSP.7.3.9.
I only extract paragraphs that I think is important. Hope this help.
May be it is container dependant I remember I ran a test in Tomcat 5.5 I put taglib in DD just beneath webapp and I do not remember getting any error. But this is not guaranteed since the spec says it should come under jsp-config.
Steven Colley
Ranch Hand
Joined: Feb 18, 2005
Posts: 290
posted
0
ok, i got it, the <taglib> is not mandatory, because the container also utilizes its map object for retrieving the related tag libraries under WEB-INF/* and jar/META-INF/*.
But my questions is..(i got a little confused regarding <jsp-config> ..
Is "<web-app><jsp-config><tag-lib> " OLD evrsion right? and for the exam the correct place for <taglib> would be "<web-app><taglib>" right?
Tks.
Narendra Dhande
Ranch Hand
Joined: Dec 04, 2004
Posts: 950
posted
0
Hi,
Originally posted by Felipe Pittella: ok, i got it, the <taglib> is not mandatory, because the container also utilizes its map object for retrieving the related tag libraries under WEB-INF/* and jar/META-INF/*.
But my questions is..(i got a little confused regarding <jsp-config> ..
Is "<web-app><jsp-config><tag-lib> " OLD evrsion right? and for the exam the correct place for <taglib> would be "<web-app><taglib>" right?
Tks.
Leung gave the detail explaination. The tomcat does not validate the web.xml for synthatic correctness. Accroding to the Servlet 2.4 the <taglib> must be placed under <jsp-config>. But it is optional.
If you want to check. Place the <uri> item in .tld with SomeName1 and define <taglib-uri> with SomeName2 in web.xml, like
<web-app ..> ....
<taglib> <taglib-uri> SomeName2 </taglib-uri> <latglib-location> your tld location </taglib-location> </taglib>
Try to use the tag library using
<%@taglib prefix="mylib" uri="SomeName2" %> in JSP <mylib:sometag />
It should not locate the required tag library, as it defined under <web-app>
It should work
<%@taglib prefix="mylib" uri="SomeName1" %> in JSP <mylib:sometag />
As the containe bulid implicit map of tag libraries.
Hope this help
Thanks
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.