top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+1 vote
440 views
Can we have more than one struts-config.xml file for a single Struts application?
posted May 15, 2014 by Riteshwar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Yes, we can have more than one struts-config.xml for a single Struts application. They can be configured as follows:

<servlet>
<servlet-name>action</servlet-name>      
  <servlet-class>
    org.apache.struts.action.ActionServlet
  </servlet-class>
<init-param>
  <param-name>config</param-name>
  <param-value>
     /WEB-INF/struts-config.xml,             
     /WEB-INF/struts-admin.xml,
     /WEB-INF/struts-config-forms.xml         
  </param-value>
</init-param>
.....
<servlet>
answer May 16, 2014 by Varuna Magar
Similar Questions
+1 vote

We are in the beginning of the migration to struts2 and it seems like there will be some period when both frameworks will be active at the same time..the only problem now is accessing the session beans managed by struts2 in struts1 and vice-versa form beans from strut1 mapped in struts2 . Half of the jsp would use struts1 tags and other half struts2 tags. So there should be beans instantiated in both frameworks.

Probably struts2 bean can be injected to struts1 action with struts1 form still accessible as execute() argument, but what about other way? accessing struts1 form bean (not just data, but managed bean) in struts2 execute() ?

+1 vote

I am migrating an application from Struts 1 to Struts 2 and frequently I am facing scenarios where I need to use request.getSession to set/get attributes. As far as my knowledge goes, this is not considered to be a best practice in Struts 2. What is the best was way to handle this scenario?

+1 vote

I have a requirement to use Struts 2.x framework for new modules in the existing web application which is currently running on Struts 1.x

I would like to have both configuration separately and I don't wish to migrate or touch any of existing source files.

Could you please provide me any sample application or user guide or any related information for my requirement? Appreciate your kind help on this.

0 votes

Is it possible to access a file that is located in the local drive or server side folder from struts.xml? as follow:

C:/Folder/jasperReport.jasper

or

%{filename} 

where the filename is avariable in the action class with the file location is hardcoded as String filename = "C:/Folder/jasperReport.jasper";

My struts2 application is deployed on JBoss as 6, it seems ServletRequestAware is unable to access the folder within war file while working with JBoss. It is working fine with tomcat. I am thinking about accessing files in the server size instead.

+2 votes

I have a couple of old struts 2 apps that are using 2.2.1. I want to upgrade them to 2.3. What is the minimal set of jar files I need in WEB-INF/lib?

I currently have:
commons-beanutils-1.7.jar
commons-collections-2.1.jar
commons-digester-1.7.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-javaflow-20060411.jar
commons-lang-2.5.jar
commons-logging-1.0.4.jar
freemarker-2.3.16.jar
ibatis-2.3.2.715.jar
itext-1.3.1.jar
jasperreports-2.0.5.jar
javamail.jar
javassist-3.8.0.GA.jar
jdt-compiler-3.1.1.jar
jstl.jar
jxl-2.6.jar
log4j-1.2.14.jar
ognl-3.0.jar
poi-3.0.1-FINAL-20070705.jar
spring.jar
standard.jar
struts2-core-2.2.1.jar
struts2-jasperreports-plugin-2.0.11.1.jar
urlrewrite-3.2.0.jar
xalan.jar
xercesImpl.jar
xwork-core-2.2.1.jar

...