I’ve got a huge struts.xml file and I want to add some logic in my struts file. I’ve decided to split it on many files like :
struts-users.xml
struts-tvshows.xml
My struts.xml file is at it follows :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.custom.i18n.resources" value="package"></constant>
<include file="struts-user.xml" />
<include file="struts-tvshows.xml" />
</struts>
I’m running into this error : Exception starting struts2 filter
The exception stacktrace says : Caused by: The package name ‘frontoffice’ at location … (location of my struts-tvshows.xml location).
So my error comes from the fact that I define the package named “frontoffice” in both files. I have to keep all my actions in the same package…
Does someone has a clue ?
AFAIK you cannot define a package across multiple config files. I don’t understand why you need to keep them in the same package, though–package names are completely arbitrary.
If your concern is an existing package definition, simply have the new packages extend that package.
From the names of the include files it looks like there’s zero reason to keep them in the same package since they appear to have completely unrelated functionality.