<p>I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity .vm files), configs (struts.xml, persistence.xml) from main WAR file.</p>

<p>I have all in default structure like: </p>

<pre>
    application
    |-- <i><b>META-INF</b></i>            -- Some configs are here
    |-- <i><b>WEB-INF</b></i>             -- others here
    |   |-- classes
    |   |   |-- META-INF
    |   |   `-- mypackage
    |   |       `-- class-files
    |   `-- lib
    |-- css
    `-- <i><b>tpl</b></i>                 -- Template dir to be relocated
</pre>

<p>And I apparently can't find documentation about how to setup (probably in struts.xml) where my templates go, and where config files will be.</p>

<p>I think I will have to use configurations on the application server too (I am using Jetty 5.1.14).</p>

<p>So, any lights on how to configure it ? </p>

<p>Thanks</p>

<hr>

<p>Well, the whole thing about changing templates place is to put the templates in a designer accessible area, so any modification needed, the designer can load them to his/her computer, edit, and upload it again. I think this is a common scenario. So, probably I am missing something in my research. Maybe I am focusing in configuring it on the wrong place ... Any thoughts ?</p>

[{'answer_id': 35867, 'author': 'Peter Hilton', 'author_id': 2670, 'author_profile': 'https://Stackoverflow.com/users/2670', 'pm_score': 0, 'selected': False, 'text': '<p>For <em>persistence.xml</em>, specifically, you can put a persistence unit in a separate JAR, which you can deploy separately from your web application WAR, or both together in an EAR archive, depending on what your application server supports. For example, the JBoss manual describes this as <a href="http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/beta422/html/ch01s04s02.html" rel="nofollow noreferrer">Deploy EAR with EJB3 JAR</a>. </p>\n\n<p>For <em>struts-config.xml</em> I expect that you are going to have to override the Struts code that loads it, if you want to use a non-standard location.</p>\n\n<p>I don\'t know about the Velocity templates.</p>\n\n<p>In general, web applications only load resources from within the WAR, for security reasons. There are other techniques you can use, but you may find it easier to try <a href="https://weblets.dev.java.net/" rel="nofollow noreferrer">weblets</a>, which seems to be a framework designed to let you load resources from a separate JAR.</p>\n'}, {'answer_id': 197980, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>You need to look into <code>velocity.properties</code> file in your WEB_INF folder.IMHO it is here where you need to change your <em>template root</em> changing the property <code>file.resource.loader.path</code>.</p>\n\n<p>Hope it helps,\nPetr</p>\n'}, {'answer_id': 234746, 'author': 'RayOK', 'author_id': 31246, 'author_profile': 'https://Stackoverflow.com/users/31246', 'pm_score': 2, 'selected': True, 'text': '<p>If I understood your question about Struts config files right, they are specified in web.xml. Find the Struts servlet config param. The param-value can be a list of comma separated list of XML files to load. Eg:</p>\n\n<pre><code>&lt;servlet&gt;\n    &lt;servlet-name&gt;action&lt;/servlet-name&gt;\n    &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;\n    &lt;init-param&gt;\n        &lt;param-name&gt;config&lt;/param-name&gt;\n        &lt;param-value&gt;\n            WEB-INF/config/struts-config.xml,\n            WEB-INF/config/struts-config-stuff.xml,\n            WEB-INF/config/struts-config-good.xml,\n            WEB-INF/config/struts-config-bad.xml,\n            WEB-INF/config/struts-config-ugly.xml\n        &lt;/param-value&gt;\n    &lt;/init-param&gt;\n    ...\n&lt;/servlet&gt;\n</code></pre>\n\n<p>See this <a href="http://struts.apache.org/1.x/userGuide/configuration.html" rel="nofollow noreferrer">Struts guide</a> under 5.3.2. And yes, this applies to 2.x also.</p>\n'}]
['https://Stackoverflow.com/questions/35507', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2274/']