You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ML...@abusinessware.com on 2007/05/16 11:03:14 UTC

[s2] break up a large struts.xml file into smaller pieces : extends problem

Hi all,

I try to separate the modules of my app in differents xml files, but the 
extends seems to have problems.

Struts.xml :
<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false" 
/>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="package" />
 
    <include file="struts-default.xml"/>
 
        <package name="default" extends="struts-default">
                <interceptors>
                <interceptor name="login" class=
"com.abw.util.LoginInterceptor" />

                        <interceptor-stack name="crmStack">
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="login"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params">
                        <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                        </interceptor-stack>
        </interceptors>

                <default-interceptor-ref name="crmStack"/>
 
                <global-results>
                        <result name="notLogged">/loginV2.jsp</result>
                        <result name="globalError">/error.jsp</result>
                </global-results>
    </package>
 
    <include file="home.xml"/>
    <include file="activites.xml"/>
</struts>

home.xml :
<struts>
        <package name="home" extends="default">
        <action name="enter" class="com.abw.coordination.EnterAction">
            <result>/loginV2.jsp</result>
        </action>
        <action name="login" class="com.abw.coordination.LoginAction">
            <result>/frame.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="bandeau" class="com.abw.coordination.BandeauAction">
        </action>
        <action name="titre" class="com.abw.coordination.TitreAction">
        </action>
        <action name="home" class="com.abw.coordination.HomeAction">
            <result type="redirectAction">
                        <param name="actionName">activites</param>
                    </result>
        </action>
        </package>
</struts>

The error :
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.ConfigurationUtil  - Unable to find parent 
package default
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider  - 
Unable to find parent packages default
2007-05-16 10:45:18,390 [main] ERROR 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/crm]  - 
Exception au démarrage du filtre struts
Error building results for action enter in namespace  - action - 
file:/C:/_applis/eclipse/workspace/CRMV2/crm-webapp/WebContent/WEB-INF/classes/home.xml:7:71
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(
XmlConfigurationProvider.java:299)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(
XmlConfigurationProvider.java:384)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(
XmlConfigurationProvider.java:239)

I would like to have the default-interceptor to be "crmStack" in each 
"sub-xml", so I would like to extends package "default" of struts.xml, not 
"struts-default";

Is that possible ?

I'm in v2.1.0-SNAPSHOT-20070425

Thanks,

Michaël.

RE: [s2] break up a large struts.xml file into smaller pieces : extends problem

Posted by David Chisholm <dc...@onenetwork.com>.
One more thing - once I upgraded to xwork 2.0.2, I was able to include my
default/base package include file first.

-- David
 


-----Original Message-----
From: David Chisholm [mailto:dchisholm@onenetwork.com] 
Sent: Wednesday, May 16, 2007 4:29 AM
To: 'Struts Users Mailing List'
Subject: RE: [s2] break up a large struts.xml file into smaller pieces :
extends problem



There's a known bug in the parsing of the struts.xml file, which I believe
has been fixed in the 2.0.2 version of the xwork library, that prevents it
from finding the packages that you define in struts.xml and later extend.
However, I was able to work around this problem by putting my own default
package into its own file and including it *last* in the struts.xml.  So, in
your case, use the following:

<struts>
   ...
  <include file="home.xml"/>
  <include file="activites.xml"/>   
  <include file="default.xml"/>
</struts>

where default.xml contains your default pacakge definition below.  I don't
like the ordering dependency of the includes, but I like how it makes my
struts.xml file cleaner.

-- David
 


-----Original Message-----
From: MLENEVEUT@abusinessware.com [mailto:MLENEVEUT@abusinessware.com] 
Sent: Wednesday, May 16, 2007 4:03 AM
To: user@struts.apache.org
Subject: [s2] break up a large struts.xml file into smaller pieces : extends
problem


Hi all,

I try to separate the modules of my app in differents xml files, but the 
extends seems to have problems.

Struts.xml :
<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false" 
/>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="package" />
 
    <include file="struts-default.xml"/>
 
        <package name="default" extends="struts-default">
                <interceptors>
                <interceptor name="login" class=
"com.abw.util.LoginInterceptor" />

                        <interceptor-stack name="crmStack">
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="login"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params">
                        <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                        </interceptor-stack>
        </interceptors>

                <default-interceptor-ref name="crmStack"/>
 
                <global-results>
                        <result name="notLogged">/loginV2.jsp</result>
                        <result name="globalError">/error.jsp</result>
                </global-results>
    </package>
 
    <include file="home.xml"/>
    <include file="activites.xml"/>
</struts>

home.xml :
<struts>
        <package name="home" extends="default">
        <action name="enter" class="com.abw.coordination.EnterAction">
            <result>/loginV2.jsp</result>
        </action>
        <action name="login" class="com.abw.coordination.LoginAction">
            <result>/frame.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="bandeau" class="com.abw.coordination.BandeauAction">
        </action>
        <action name="titre" class="com.abw.coordination.TitreAction">
        </action>
        <action name="home" class="com.abw.coordination.HomeAction">
            <result type="redirectAction">
                        <param name="actionName">activites</param>
                    </result>
        </action>
        </package>
</struts>

The error :
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.ConfigurationUtil  - Unable to find parent 
package default
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider  - 
Unable to find parent packages default
2007-05-16 10:45:18,390 [main] ERROR 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/crm]  - 
Exception au démarrage du filtre struts
Error building results for action enter in namespace  - action - 
file:/C:/_applis/eclipse/workspace/CRMV2/crm-webapp/WebContent/WEB-INF/class
es/home.xml:7:71
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(
XmlConfigurationProvider.java:299)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage
(
XmlConfigurationProvider.java:384)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackag
es(
XmlConfigurationProvider.java:239)

I would like to have the default-interceptor to be "crmStack" in each 
"sub-xml", so I would like to extends package "default" of struts.xml, not 
"struts-default";

Is that possible ?

I'm in v2.1.0-SNAPSHOT-20070425

Thanks,

Michaël.


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


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


RE: [s2] break up a large struts.xml file into smaller pieces : extends problem

Posted by David Chisholm <dc...@onenetwork.com>.
There's a known bug in the parsing of the struts.xml file, which I believe
has been fixed in the 2.0.2 version of the xwork library, that prevents it
from finding the packages that you define in struts.xml and later extend.
However, I was able to work around this problem by putting my own default
package into its own file and including it *last* in the struts.xml.  So, in
your case, use the following:

<struts>
   ...
  <include file="home.xml"/>
  <include file="activites.xml"/>   
  <include file="default.xml"/>
</struts>

where default.xml contains your default pacakge definition below.  I don't
like the ordering dependency of the includes, but I like how it makes my
struts.xml file cleaner.

-- David
 


-----Original Message-----
From: MLENEVEUT@abusinessware.com [mailto:MLENEVEUT@abusinessware.com] 
Sent: Wednesday, May 16, 2007 4:03 AM
To: user@struts.apache.org
Subject: [s2] break up a large struts.xml file into smaller pieces : extends
problem


Hi all,

I try to separate the modules of my app in differents xml files, but the 
extends seems to have problems.

Struts.xml :
<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false" 
/>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="package" />
 
    <include file="struts-default.xml"/>
 
        <package name="default" extends="struts-default">
                <interceptors>
                <interceptor name="login" class=
"com.abw.util.LoginInterceptor" />

                        <interceptor-stack name="crmStack">
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="login"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params">
                        <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse
</param>
                </interceptor-ref>
                        </interceptor-stack>
        </interceptors>

                <default-interceptor-ref name="crmStack"/>
 
                <global-results>
                        <result name="notLogged">/loginV2.jsp</result>
                        <result name="globalError">/error.jsp</result>
                </global-results>
    </package>
 
    <include file="home.xml"/>
    <include file="activites.xml"/>
</struts>

home.xml :
<struts>
        <package name="home" extends="default">
        <action name="enter" class="com.abw.coordination.EnterAction">
            <result>/loginV2.jsp</result>
        </action>
        <action name="login" class="com.abw.coordination.LoginAction">
            <result>/frame.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="bandeau" class="com.abw.coordination.BandeauAction">
        </action>
        <action name="titre" class="com.abw.coordination.TitreAction">
        </action>
        <action name="home" class="com.abw.coordination.HomeAction">
            <result type="redirectAction">
                        <param name="actionName">activites</param>
                    </result>
        </action>
        </package>
</struts>

The error :
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.ConfigurationUtil  - Unable to find parent 
package default
2007-05-16 10:45:18,374 [main] ERROR 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider  - 
Unable to find parent packages default
2007-05-16 10:45:18,390 [main] ERROR 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/crm]  - 
Exception au démarrage du filtre struts
Error building results for action enter in namespace  - action - 
file:/C:/_applis/eclipse/workspace/CRMV2/crm-webapp/WebContent/WEB-INF/class
es/home.xml:7:71
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(
XmlConfigurationProvider.java:299)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage
(
XmlConfigurationProvider.java:384)
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackag
es(
XmlConfigurationProvider.java:239)

I would like to have the default-interceptor to be "crmStack" in each 
"sub-xml", so I would like to extends package "default" of struts.xml, not 
"struts-default";

Is that possible ?

I'm in v2.1.0-SNAPSHOT-20070425

Thanks,

Michaël.


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