Can I have more than one struts-config.xml file for a single Struts application?

Showing Answers 1 - 55 of 55 Answers

Pavan

  • Sep 5th, 2006
 

Yes, It is possible in case of maintaing seperate module specific information.

Arvind Kumar Singh

  • Sep 5th, 2006
 

Yes we can.. for example..

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-fndt-config.xml,/WEB-INF/struts-plugin-config.xml,/WEB-INF/struts-app-config.xml</param-value>

</init-param>

kamlesh sharma

  • Sep 16th, 2006
 

Yes we can have more than one struts-config.xml files for a single struts
application in condition.

1. If we have more than one module in our application.


Code
  1.  

  2. ..............

  3. .............

  4. <init-param>

  5.     <param-name>

  6.         config

  7.     </param-name>

  8.     <param-value>

  9.         /WEB-INF/struts-config.xml

  10.     </param-value>

  11. </init-param>

  12. <init-param>

  13.     <param-name>

  14.         config/login

  15.     </param-name>

  16.     <param-value>

  17.         /WEB-INF/struts-config-login.xml

  18.     </param-value>

  19. </init-param>

  20. .............

  21. .........


Where default and login our two module.

2. If we want to use more than one
struts-config.xml files to make our application simple.



Code
  1.  

  2. ..............

  3. .............

  4. <init-param>

  5.     <param-name>

  6.         config

  7.     </param-name>

  8.     <param-value>

  9.         /WEB-INF/struts-config.xml,/WEB-INF/struts-config-login.xml

  10.     </param-value>

  11. </init-param>

  12. .............

  13. .........

  Was this answer useful?  Yes

ramesh

  • Sep 27th, 2006
 

Yes u can maintain module wise configuration file in struts.....These are new features in Struts1.1

A number of new features have

been incorporated into this release, including

Use of Jakarta Commons libraries such as BeanUtils and Logging

DynaActionsForms for creating dynamic action forms that do not require any coding

Multiple application support for allowing multiple struts−config.xml files to be defined

Nested tag library for allowing a nested object hierarchy to be easily accessed from JSPs

Plugin API for ActionServlet enhancements

Declarative exception handling that allows Actions to not have to worry about catching

all exceptions

  Was this answer useful?  Yes

Anand

  • Oct 7th, 2006
 

Yes, We can have More than one struts-config.xml file in single struts application.

ANNAD

  Was this answer useful?  Yes

ramakrishna

  • Oct 31st, 2006
 

yes,

by using switch action you can configure more than strus-config.xml,

but each struts-config.xml files specific to modlues

  Was this answer useful?  Yes

Yes it is possible... If you are developing the distributed applications (means do you have diff modules),
then you can provide any number of struts-config.xml files based on your number of modules.
But the thing is you must enter those struts-config.xml files details in deployment descripter (i.e., web.xml) like

<init-param>
<param-name>
config</param-name>
<param-value>/WEB-INF/struts-first-config.xml,/WEB-INF/struts-second-config.xml,/WEB-INF/struts-third-config.xml</param-value>
</init-param>

Here I assumed as 'I have 3 modules'. Thats why I entered 3 struts-config.xml files information.
In the time of calling files which are provided under different modules, you must provide Page and prefix attributes in
your URL.


Yes, we can have more than one struts-config.xml file in a web application.
Each struts-config.xml file for different modules in our application.

Declaration in web.xml is:

<init-param id="InitParam_3">

<param-name>config/pullman</param-name>

<param-value>/WEB-INF/calculator/struts-pullman-config.xml</param-value>

</init-param>

<init-param id="InitParam_4">

<param-name>config/kcaa</param-name>

<param-value>/WEB-INF/feature/struts-kcaa-config.xml</param-value>

</init-param>

  Was this answer useful?  Yes

Yes you can maintain seperate struts-config.xml file but that would be useful only in case you need to have seperate modules.

But for sure its possible.


Thanks,
Vinay

  Was this answer useful?  Yes

Kannan

  • Aug 2nd, 2011
 

Yes, we can have more than one struts-config.xml in a single struts application

Code
  1. <servlet>

  2. <servlet-name>action</servlet-name>

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

  4. <init-param>

  5. <param-name>config</param-name>

  6. <param-value>

  7.            /WEB-INF/struts-config.xml,

  8.            /WEB-INF/struts-admin.xml,

  9.            /WEB-INF/struts-config-forms.xml  

  10. </param-value>

  11. </init-param>

  12. </servlet>

  Was this answer useful?  Yes

sunil

  • Aug 20th, 2011
 

NO we have only one config file is struts as this is defined standard in it.

  Was this answer useful?  Yes

Ankit Mathur

  • Aug 23rd, 2011
 

Yes
if u want to add another struts-config file .
do this

<--->struts-config.xml,app-config.xml
in web.xml fle

  Was this answer useful?  Yes

Naveen

  • Sep 12th, 2011
 

If i have given same config names but different Struts-config files

Then what happen there? Is it error or Exception thrown or overrides 2 config name??? reply me please to my mail navin8055@gmail.com Thank you

  Was this answer useful?  Yes

Rohini

  • Sep 12th, 2011
 

We can have more than one struts config files as per different modules. Tags mentioned in above answers is reuired to be added in Web.xml which acts as deployment descriptor of all modules as one application.

  Was this answer useful?  Yes

Dileep Kumar Binod

  • Dec 29th, 2011
 

Yes it is possible... If you are developing the distributed applications (means do you have diff modules),
then you can provide any number of struts-config.xml files based on your number of modules.
But the thing is you must enter those struts-config.xml files details in deployment descripter (i.e., web.xml) like

Code
  1.  

  2. <init-param>

  3.  

  4. <param-name>

  5. config</param-name>

  6. <param-value>/WEB-INF/struts-first-config.xml,/WEB-INF/struts-second-config.xml,/WEB-INF/struts-third-config.xml</param-value>

  7.  

  8. </init-param>


Here I assumed as I have 3 modules. Thats why I entered 3 struts-config.xml files information.
In the time of calling files which are provided under different modules, you must provide Page and prefix attributes in
your URL.

  Was this answer useful?  Yes

pdommara

  • Dec 29th, 2011
 

Yes you can have two or more. But you need to configure at web.xml and the container reads from web.xml.


Thanks
Praveen.

  Was this answer useful?  Yes

ABHAY RAI

  • Aug 28th, 2012
 

Yes,You have more than one struts-config file in one single struts application.

  Was this answer useful?  Yes

GK

  • Oct 7th, 2012
 

Yes. In web.xml we can define as follows


action
org.apache.struts.action.ActionServlet

config
/WEB-INF/struts-config.xml,/WEB-INF/struts-my-config.xml,

2

  Was this answer useful?  Yes

Durgesh Rai

  • Nov 5th, 2014
 

Yes it is possible....In web.xml we can define all struts-Cfg.xml

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions