Changing the default file structure in a Java Struts application

I have been working with Struts for some time, but for the project I'm finishing, I was asked to separate Templates (.vm speed files), configs (struts.xml, persistence.xml) from the main WAR file.

I have everything in the default structure, for example:

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

And I apparently cannot find the documentation on how to configure (possibly in struts.xml) where my templates go and where the configuration files will be.

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

So, any lights on how to set it up?

thank


So, with regard to changing templates, it is to place the templates in an accessible area of ​​the designer, so any necessary changes, the designer can download them to his computer, edit and download again. I think this is a common scenario. Therefore, probably, I missed something in my research. Maybe I'm focusing on setting it in the wrong place ... Any thoughts?

+3
source share
3 answers

Struts, web.xml. Struts. XML . :

<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/config/struts-config.xml,
            WEB-INF/config/struts-config-stuff.xml,
            WEB-INF/config/struts-config-good.xml,
            WEB-INF/config/struts-config-bad.xml,
            WEB-INF/config/struts-config-ugly.xml
        </param-value>
    </init-param>
    ...
</servlet>

Struts 5.3.2. , 2.x.

+1

persistence.xml, , JAR, - WAR EAR, , . , JBoss EAR EJB3 JAR.

struts-config.xml , Struts, , .

Velocity.

, - WAR . , , weblets, , , , JAR.

0

You need to look at the file velocity.propertiesin the WEB_INF.IMHO folder, here you need to change the root of your template by changing the property file.resource.loader.path.

Hope this helps, Petr

0
source

Source: https://habr.com/ru/post/1696598/


All Articles