struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Bathje" <...@ntsource.com>
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"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"
[
<!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:

<action-mappings>
<!-- hard coded action mapping, just for this app -->
<action parameter=".view.checkoutPage" path="/checkoutPage"
type="org.apache.struts.actions.ForwardAction"/>

<!-- include common action mappings -->
&actionMappings;

</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
time!!).


Matt Bathje



----- Original Message ----- 
From: "Hubert Rabago" <jakartauser@yahoo.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
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
of
> 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]" <james.h.anderson@citigroup.com> 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
of
> > 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!
> http://webhosting.yahoo.com/ps/sb/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message