When you use an include, the entire included document is parsed and
added to the configuration. This means that the included document must
work as if it were a stand-alone configuration file. You'll have to not
only create well-formed struts xml files, but package configuration as
well. If you're going to reuse interceptors, etc., then you'll need to
pull them in with "extends".

-Wes

On Tue, 2008-07-15 at 23:53 -0400, Dave Belfer-Shevett wrote:
> This seems like it should work, but I'm getting all sorts of hassles, and 
> the documentation page for this, naturally, provides no examples of what 
> the include file should look like.
> 
> My struts.xml has...
> 
> <!DOCTYPE struts PUBLIC
>      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>      "http://struts.apache.org/dtds/struts-2.0.dtd";>
> <struts>
>       <include file="struts-editevent.xml">
>       <package name="CONGO" extends="struts-default">
>               <interceptors>
>               [blah blah blah]
>               </interceptors>
>       (more actions)
>       </package>
> </struts>
> 
> The 'struts-editevent.xml' has:
>       <action name="coconut/viewEditEvent" method="load" 
> class="com.stonekeep.congo.coconut.EditEvent">
>               <interceptor-ref name="mystack" />
>               <result 
> name="success">/WEB-INF/jsp/coconut/EditEventForm.jsp</result>
>               <result name="login" 
> type="redirect-action">coconut/showloginpage</result>
>       </action>
> 
>       <action name="coconut/postEditEvent" method="update" 
> class="com.stonekeep.congo.coconut.EditEvent">
>               <interceptor-ref name="mystack" />
>               <result 
> name="success">/WEB-INF/jsp/coconut/Maintenance.jsp</result>
>               <result 
> name="input">/WEB-INF/jsp/coconut/EditEventForm.jsp</result>
>               <result name="login" 
> type="redirect-action">coconut/showloginpage</result>
>       </action>
> 
> A basic block of actions.
> 
> I'm getting XML validatoin errors up the wazoo because the 
> struts-editevent.xml file isn't well-formed.  If I put it in <struts> 
> blocks, I get "you're referencing interceptors that don't exist".
> 
> If I try and duplicate the entire package, interceptors, and DTD 
> definition into the include file, I get package collisions.
> 
> My take is the <include> function does not work as described in the 
> documentation.  It should be a linear include, and the resulting document 
> is parsed by SAX, but that doesn't seem to be happening.
> 
> Can someone give me an example of an included XML file that actually 
> works?
> 
> Here are links to what I'm seeing:
> My main struts.xml: http://pastebin.stonekeep.com/4955
> 
> My struts-editevent.xml: http://pastebin.stonekeep.com/4956
> 
> What happens when I deploy:
> 
> http://pastebin.stonekeep.com/4957
> 
> Note that says "no grammar found".  Adding the DTD says "you need a 
> package name in your struts block" - etc etc etc.  It never really 
> resolves.
> 
> Can someone show me an <include> setup that actually works?
> 


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

Reply via email to