--- QM <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 28, 2004 at 08:57:49AM -0700, Woodchuck wrote:
> : under the <web-app> section of the web.xml file, can we arbitrarily
> : reference other xml files?
> : that is, if i put all my <servlet> tags in one file
> (my_servlets.xml)
> : and all my <servlet-mapping> tags in another file
> (my_mappings.xml), is
> : it possible to reference these from the web.xml file (and not upset
> : tomcat in doing so)?
> 
> Yes and no: you can call external entity references (which, in turn,
> point to files) from your web.xml; but as there is no guarantee of
> what
> is a webapp's "current directory" you'd have to hardcode those paths.
> That would make your app less portable between containers and perhaps
> even different Tomcat revs.
> 
> You could merge your files of <servlet> and <servlet-mapping> tags at
> build time. For example, I use the Ant tasks <loadfile> and <copy> +
> <filter>.  If you're interested, I'll post that in detail.

actually i'm using Ant too.  i'm pre-compiling using the <jspc> task
and it generates a file containing <servlet> and <servlet-mapping>
tags.  that's exactly what i need to do really, is to merge this file
with my web.xml file.  if you can show me how you're doing it that
would be great, thanks!  i didn't look into doing this right away
because i thought it would be simpler to just have web.xml point to
this file... :p

> 
> 
> : also, i was experimenting and discovered i could place <servlet>
> tags
> : and <servlet-mapping> tags in different orders (within <web-app>
> : section) and it still works!
> 
> What servlet spec do you specify in your web.xml?
> IIRC 2.4's schema permits a more logical order, such as 
> 
>       <servlet>
>       <servlet-mapping>
>       <servlet>
>       <servlet-mapping>
> 
> -but don't quote me on that, as I don't have the spec in front of me
> right now.

my web.xml header is this:

<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd";>

i didn't alternate <servlet> and <servlet-mapping> though.  i kept the
'group' integrity so all the <servlet> tags were together first, then
came all the <servlet-mapping> tags.  what i did mix up though, was
putting this chunk in various places within the <web-app> tag.  for
example i put this chunk as the very last 'section' before </web-app>,
then i tried putting this chunk right in-between two <taglib>
definitions.  in both cases, when tomcat 'picked up' these changes it
caused various parsing-related errors on the console, however my
application still worked *seemingly* without any problems.




        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to