struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Bathje" <>
Subject Re: Is there an INCLUDE feature that works with struts-config?
Date Mon, 02 Feb 2004 17:35:22 GMT
I think XML entities would do what he wants.

What you do is, at the top of your struts-config.xml file, you define the
entities you want to include:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
<!ENTITY actionMappings SYSTEM "/path/to/actionMappings.xml">
<!ENTITY formBeans SYSTEM "/path/to/formBeans.xml">

Then, at each place you want to use the entity in your file, you include it
as an entity using &entityName; (so for the above example: &actionMappings;
and &formBeans;)

So to include action mappings in your struts config that you have defined in
another file, you would do:

<!-- hard coded action mapping, just for this app -->
<action parameter=".view.checkoutPage" path="/checkoutPage"

<!-- include common action mappings -->


In struts-config, the entity paths can be relative to your struts-config.xml
file (usually /WEB-INF/), or hard coded paths to somewhere else on the file
system. If you want to use entities in tiles-defs.xml or validation.xml,
they must be hard coded paths (for now...I'm investigating this in my free

Matt Bathje

----- Original Message ----- 
From: "Hubert Rabago" <>
To: "Struts Users Mailing List" <>
Sent: Monday, February 02, 2004 11:23 AM
Subject: Re: Is there an INCLUDE feature that works with struts-config?

> Probably not in the way you're thinking.
> Struts allows you to specify more multiple config files for the same
> app, so you can probably specify the app-specific config and the shared
> config for each app.  However, each of your apps will need to have copies
> the same shared XML.
> If you're worried about duplication, you can have the shared config in
> one location and have your build process copy it from there.
> Just an idea.
> - Hubert
> --- "Anderson, James H [IT]" <> wrote:
> > We will have many related Struts apps that require identical entries in
> > struts-config, so I'm wondering if there's a way to define common sets
> > entries and then include them in the config file for each of the apps.
> >
> > Thanks,
> >
> > jim
> >
> >
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message