Alexey Rumyantsev (lexis) wrote,

xml include for web.xml

Sometimes it is useful to split configuration in web.xml to different files. For example we can overwrite some configuration parts by scripts, etc., so we will not need to parse full web.xml to update it.

It can be done following way:

web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd" [
  <!ENTITY textreplacements SYSTEM "textreplacements.xml">
]>
<web-app>
    <filter>
        <filter-name>TextReplaceFilter</filter-name>
        <filter-class>TextReplaceFilter</filter-class>
        &textreplacements;
    </filter>
</web-app>

textreplacements.xml
<init-param>
    <param-name>TEXT_TO_REPLACE</param-name>
    <param-value>REPLACEMENT</param-value>
</init-param>

Tags: java, web.xml, xml
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

  • 0 comments