• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Split web.xml into smaller manageable xml files

 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

For projects that have big web.xml and many developers working on it, is it possible to split it into smaller separate manageable XML files? I tried using the <!ENTITY filter SYSTEM "filter.xml"> to replace my <filter> tags but gotten parser errors.

Anyone done something of this before? Is it feasible?

Many thanks!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, I don't think that you can split the Deployment Descriptor.
 
Praveen Babu
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chengwei Lee:
Hi all,

For projects that have big web.xml and many developers working on it, is it possible to split it into smaller separate manageable XML files? I tried using the <!ENTITY filter SYSTEM "filter.xml"> to replace my <filter> tags but gotten parser errors.

Anyone done something of this before? Is it feasible?

Many thanks!



Hi,
I have split the struts-config.xml file into 2 files like this

In struts-config.xml use

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd"[

<!ENTITY actions SYSTEM "actions.xml">

]>

<!-- =============== Mappings in actions.xml ===================== -->
&actions;

and actions.xml is a normal xml file.

Use this to split web.xml. I have never tested it with web.xml so tell me if it works.

Regards,
Praveen
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen,

Thanks for the example, seems that Satou is right, the DD cannot be splitted. Tried following your example to breakdown the web.xml but the server complained malformed XML.

Cheers!
 
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
If the web.xml is so big because you have many individual servlet definitions, your app could benefit from using a Front Controller. Please read this article for more information.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
If the web.xml is so big because you have many individual servlet definitions, your app could benefit from using a Front Controller. Please read this article for more information.


I know what you mean, unfortunately it's a live application and any major refactoring work has to be done in small incremental stages. A front controller is what we're working towards, but meanwhile, it would be good if we could breakdown the web.xml.

 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can split the web.xml into smaller manageable files:


<?xml versionfiltered="1.0" standalone="no"?>
<!DOCTYPE webapp [
<!ENTITY servlets SYSTEM "servlets.xml">
]>
<webapp>
&servlets;
</webapp>

where servlets.xml has

<servlet>
<servlet-name>blah</servlet-name>
<display-name>blah</display-name>
<servlet-class>blah.blahclass/servlet-class>
</servlet>
.....
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what version of tomcat are you using? the latest version 5.5.17 should support it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic