You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Néstor Boscán <ne...@tcs.com.ve> on 2005/04/11 05:04:10 UTC

Multiple struts-config.xml

Hi
 
I have an application and I need to create many web flows. If I use struts
to model the web flows, is it possible to use many struts-config.xml instead
of one?
 
Regards,
 
Néstor Boscán


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


Re: Multiple struts-config.xml

Posted by sridhar <sr...@wicore.com>.
Hi N�stor Bosc�n,

    You can use multiple struts-config.xml files.

    for that you have modify web.xml file

    steps

    1. in  ActionServlet init params u can pass all the struts-config.xml 
file(s) as a values.



    <servlet>
                  <servlet-name>action</servlet-name>

                  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

                         <init-param>
                               <param-name>config/main</param-name>
                               <param-value>/WEB-INF/struts-config-main.xml</param-value>
                          </init-param>

                         <init-param>
                               <param-name>config/admin</param-name>
                               <param-value>/WEB-INF/struts-config-admin.xml</param-value>
                          </init-param>

                         <init-param>
                               <param-name>config/manager</param-name>
                               <param-value>/WEB-INF/struts-config-manager.xml</param-value>
                          </init-param>
   </servlet>

like this u can configure use multiple struts-config.xml files.


rgds,
sridhar






"N�stor Bosc�n" <ne...@tcs.com.ve> wrote in message 
news:200504110304.j3B3497e020674@rs26s12.datacenter.cha.cantv.net...
Hi

I have an application and I need to create many web flows. If I use struts
to model the web flows, is it possible to use many struts-config.xml instead
of one?

Regards,

N�stor Bosc�n 




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


RE: Multiple struts-config.xml

Posted by Mark Benussi <ma...@hotmail.com>.
Exactly what I was going to say James, I started to use modules, but
switched to multiple configs as it was becoming a nightmare. All my actions
in each config share a pattern like James suggested.

-----Original Message-----
From: James Mitchell [mailto:jmitchell@apache.org] 
Sent: 11 April 2005 11:42
To: Struts Users Mailing List; wolff@manfred-wolff.de
Subject: Re: Multiple struts-config.xml

I would caution anyone about using Modules.  It is not for the beginner. 
Working with Struts Modules can be extremely confusing to the novice Struts 
developer.  I think a better solution is to suggest that they use multi 
config, but make sure they use a common pattern between multiple config xml 
files.

So, in struts-config-client.xml, all mappings would be like <action 
path="/Client/Foo" ...
And in struts-config-employee.xml, all mapping would be like <action 
path="Employee/Bar" ...
And for commonly shared things like login or whatever, you could have a 
struts-config-common.xml with <action path="/Common/Baz"

The same style of naming would apply for other entries, like action forms, 
global forward, and the rest.



--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring / Freelance
EdgeTech, Inc.
678.910.8017
AIM:   jmitchtx
Yahoo: jmitchtx
MSN:   jmitchell@apache.org




----- Original Message ----- 
From: "Manfred Wolff" <wo...@manfred-wolff.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, April 11, 2005 2:48 AM
Subject: Re: Multiple struts-config.xml


>
> Hi
>
> A better way is to use struts modules. Every Module has its own 
> struts-configuration. If you use more than one struts configuration such 
> as described below, you  may have problems with duplicate identifiers, 
> becaus struts builds one configuration out of all files. This problems you

> don't have using modules. Modules acts as a namespace in this case.
>
> -Manfred
>
> -- 
>
> ===========================================
> Dipl.-Inf. Manfred Wolff
> Software Engineer
> -------------------------------------------
> http://www.manfred-wolff.de
> http://www.struts-it.org
> -------------------------------------------
>
>
> Folashade Adeyosoye wrote:
>
>>Yes, in your web.xml
>>
>>
>>Change this...
>>
>>  <servlet>
>>    <servlet-name>AppName</servlet-name>
>>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>>    <init-param>
>>      <param-name>config</param-name>
>>      <param-value>/WEB-INF/struts-config.xml</param-value>
>>    </init-param>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>To
>>
>>  <servlet>
>>    <servlet-name> AppName </servlet-name>
>>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>>    <init-param>
>>      <param-name>config</param-name>
>>
<param-value>/WEB-INF/struts-config.xml,/WEB-INF/the-employee-config.xml,/WE
>>B-INF/the-admin-config.xml,/WEB-INF/the-client-config.xml,/WEB-INF/the-bil
li
>>ng-config.xml,/WEB-INF/the-report-config.xml,/WEB-INF/the-patient-config.x
ml
>></param-value>
>>    </init-param>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>
>>-----Original Message-----
>>From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve] Sent: Sunday, April 
>>10, 2005 11:04 PM
>>To: 'Struts Users Mailing List'
>>Subject: Multiple struts-config.xml
>>
>>Hi
>> I have an application and I need to create many web flows. If I use 
>> struts
>>to model the web flows, is it possible to use many struts-config.xml 
>>instead
>>of one?
>> Regards,
>> Néstor Boscán
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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


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


Re: Multiple struts-config.xml

Posted by James Mitchell <jm...@apache.org>.
I would caution anyone about using Modules.  It is not for the beginner. 
Working with Struts Modules can be extremely confusing to the novice Struts 
developer.  I think a better solution is to suggest that they use multi 
config, but make sure they use a common pattern between multiple config xml 
files.

So, in struts-config-client.xml, all mappings would be like <action 
path="/Client/Foo" ...
And in struts-config-employee.xml, all mapping would be like <action 
path="Employee/Bar" ...
And for commonly shared things like login or whatever, you could have a 
struts-config-common.xml with <action path="/Common/Baz"

The same style of naming would apply for other entries, like action forms, 
global forward, and the rest.



--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring / Freelance
EdgeTech, Inc.
678.910.8017
AIM:   jmitchtx
Yahoo: jmitchtx
MSN:   jmitchell@apache.org




----- Original Message ----- 
From: "Manfred Wolff" <wo...@manfred-wolff.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, April 11, 2005 2:48 AM
Subject: Re: Multiple struts-config.xml


>
> Hi
>
> A better way is to use struts modules. Every Module has its own 
> struts-configuration. If you use more than one struts configuration such 
> as described below, you  may have problems with duplicate identifiers, 
> becaus struts builds one configuration out of all files. This problems you 
> don't have using modules. Modules acts as a namespace in this case.
>
> -Manfred
>
> -- 
>
> ===========================================
> Dipl.-Inf. Manfred Wolff
> Software Engineer
> -------------------------------------------
> http://www.manfred-wolff.de
> http://www.struts-it.org
> -------------------------------------------
>
>
> Folashade Adeyosoye wrote:
>
>>Yes, in your web.xml
>>
>>
>>Change this...
>>
>>  <servlet>
>>    <servlet-name>AppName</servlet-name>
>>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>>    <init-param>
>>      <param-name>config</param-name>
>>      <param-value>/WEB-INF/struts-config.xml</param-value>
>>    </init-param>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>To
>>
>>  <servlet>
>>    <servlet-name> AppName </servlet-name>
>>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>>    <init-param>
>>      <param-name>config</param-name>
>> <param-value>/WEB-INF/struts-config.xml,/WEB-INF/the-employee-config.xml,/WE
>>B-INF/the-admin-config.xml,/WEB-INF/the-client-config.xml,/WEB-INF/the-billi
>>ng-config.xml,/WEB-INF/the-report-config.xml,/WEB-INF/the-patient-config.xml
>></param-value>
>>    </init-param>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>
>>-----Original Message-----
>>From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve] Sent: Sunday, April 
>>10, 2005 11:04 PM
>>To: 'Struts Users Mailing List'
>>Subject: Multiple struts-config.xml
>>
>>Hi
>> I have an application and I need to create many web flows. If I use 
>> struts
>>to model the web flows, is it possible to use many struts-config.xml 
>>instead
>>of one?
>> Regards,
>> Néstor Boscán
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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: Multiple struts-config.xml

Posted by Folashade Adeyosoye <sh...@gmail.com>.
I don’t see how you would have problems with names, if you have unique form
names, you would also have unique attribute names. Even thou you have the
same attributes:


>From the example below, one can have a form attribute called id in each
struts-config.

This method had been used on a system that is live now, with no problem.


-----Original Message-----
From: Manfred Wolff [mailto:wolff@manfred-wolff.de] 
Sent: Monday, April 11, 2005 2:48 AM
To: Struts Users Mailing List
Subject: Re: Multiple struts-config.xml


Hi

A better way is to use struts modules. Every Module has its own 
struts-configuration. If you use more than one struts configuration such 
as described below, you  may have problems with duplicate identifiers, 
becaus struts builds one configuration out of all files. This problems 
you don't have using modules. Modules acts as a namespace in this case.

-Manfred

-- 

===========================================
Dipl.-Inf. Manfred Wolff
Software Engineer
-------------------------------------------
http://www.manfred-wolff.de
http://www.struts-it.org
-------------------------------------------


Folashade Adeyosoye wrote:

>Yes, in your web.xml
>
>
>Change this...
>
>  <servlet>
>    <servlet-name>AppName</servlet-name>
>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>    <init-param>
>      <param-name>config</param-name>
>      <param-value>/WEB-INF/struts-config.xml</param-value>
>    </init-param>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>
>To 
>
>
>  <servlet>
>    <servlet-name> AppName </servlet-name>
>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>    <init-param>
>      <param-name>config</param-name>
> 
><param-value>/WEB-INF/struts-config.xml,/WEB-INF/the-employee-config.xml,/W
E
>B-INF/the-admin-config.xml,/WEB-INF/the-client-config.xml,/WEB-INF/the-bill
i
>ng-config.xml,/WEB-INF/the-report-config.xml,/WEB-INF/the-patient-config.xm
l
></param-value>
>    </init-param>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>
>
>-----Original Message-----
>From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve] 
>Sent: Sunday, April 10, 2005 11:04 PM
>To: 'Struts Users Mailing List'
>Subject: Multiple struts-config.xml
>
>Hi
> 
>I have an application and I need to create many web flows. If I use struts
>to model the web flows, is it possible to use many struts-config.xml
instead
>of one?
> 
>Regards,
> 
>Néstor Boscán
>
>
>---------------------------------------------------------------------
>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
>
>
>  
>


---------------------------------------------------------------------
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: Multiple struts-config.xml

Posted by Manfred Wolff <wo...@manfred-wolff.de>.
Hi

A better way is to use struts modules. Every Module has its own 
struts-configuration. If you use more than one struts configuration such 
as described below, you  may have problems with duplicate identifiers, 
becaus struts builds one configuration out of all files. This problems 
you don't have using modules. Modules acts as a namespace in this case.

-Manfred

-- 

===========================================
Dipl.-Inf. Manfred Wolff
Software Engineer
-------------------------------------------
http://www.manfred-wolff.de
http://www.struts-it.org
-------------------------------------------


Folashade Adeyosoye wrote:

>Yes, in your web.xml
>
>
>Change this...
>
>  <servlet>
>    <servlet-name>AppName</servlet-name>
>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>    <init-param>
>      <param-name>config</param-name>
>      <param-value>/WEB-INF/struts-config.xml</param-value>
>    </init-param>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>
>To 
>
>
>  <servlet>
>    <servlet-name> AppName </servlet-name>
>    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
>    <init-param>
>      <param-name>config</param-name>
> 
><param-value>/WEB-INF/struts-config.xml,/WEB-INF/the-employee-config.xml,/WE
>B-INF/the-admin-config.xml,/WEB-INF/the-client-config.xml,/WEB-INF/the-billi
>ng-config.xml,/WEB-INF/the-report-config.xml,/WEB-INF/the-patient-config.xml
></param-value>
>    </init-param>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>
>
>-----Original Message-----
>From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve] 
>Sent: Sunday, April 10, 2005 11:04 PM
>To: 'Struts Users Mailing List'
>Subject: Multiple struts-config.xml
>
>Hi
> 
>I have an application and I need to create many web flows. If I use struts
>to model the web flows, is it possible to use many struts-config.xml instead
>of one?
> 
>Regards,
> 
>Néstor Boscán
>
>
>---------------------------------------------------------------------
>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
>
>
>  
>


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


RE: Multiple struts-config.xml

Posted by Folashade Adeyosoye <sh...@gmail.com>.
Yes, in your web.xml


Change this...

  <servlet>
    <servlet-name>AppName</servlet-name>
    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

To 


  <servlet>
    <servlet-name> AppName </servlet-name>
    <servlet-class>com.path.to.the.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
 
<param-value>/WEB-INF/struts-config.xml,/WEB-INF/the-employee-config.xml,/WE
B-INF/the-admin-config.xml,/WEB-INF/the-client-config.xml,/WEB-INF/the-billi
ng-config.xml,/WEB-INF/the-report-config.xml,/WEB-INF/the-patient-config.xml
</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>


-----Original Message-----
From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve] 
Sent: Sunday, April 10, 2005 11:04 PM
To: 'Struts Users Mailing List'
Subject: Multiple struts-config.xml

Hi
 
I have an application and I need to create many web flows. If I use struts
to model the web flows, is it possible to use many struts-config.xml instead
of one?
 
Regards,
 
Néstor Boscán


---------------------------------------------------------------------
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