i'm trying to configure struts 2.1 so that it finds my struts config file under /WEB-INF/config/, but for some reason this is proving more difficult than what i thought it would be.
what i have tried so far is:
1) put the config file in the root of my java sources dir, which means that when i build my project (in eclipse) the file is copied to the classes dir and is thereby automatically put on the classpath. doing it this way means it's enough to put the following in web.xml:
2) do the above (1), and in a more or less empty struts-config.xml have an <include /> element, trying to include a second struts config file with the bulk of the config stuff from /WEB-INF/config/, but i seem to not be able to get the include to find the second file despite trying absolute and relative paths, leading and non-leading slash etc.
3) do the above (1), but instead of just struts-config.xml put /WEB-INF/config/struts-config.xml
4) doing the above (1), but have a second <init-param> block and specify the struts-config.xml file there. the first <init-param> block would only have the first two values, struts-default.xml and struts-plugin.xml. i wasn't quite sure what the param-name should be though, and i havent been able to find out what the valid init parameters are for StrutsPrepareAndExecuteFilter.
any help would be appreciated. this really shouldn't be very hard, and it's quite possible that im missing something obvious
Well, they're all in one place if they're in the classpath, too.
posted 11 years ago
yes. makes more sense to me to have config files in a config directory, rather than in a java source directory...
i'll fiddle around with a build script and see if i can work it out.
thanks for your feedback