Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following are some tips and tricks to squeeze the most performance out of Struts 2.

(warning) Turn off logging and devMode.

...

Struts 2 uses some external javascript libraries and cascading stylesheets for certain themes and tags. These by default are located inside the Struts 2 jar, and a special filter returns them when requesting a special path (/struts). Although Struts 2 can handle these requests, an application/servlet container is not optimized for these kind of requests. Consider moving these .js and .css files to a seperated server (Lighttpd, Apache HTTPD, ..).

(warning) Create a freemarker.properties file in your WEB-INF/classes directory.

...

See also: Freemarker configuration properties

(warning) Enable Freemarker template caching

...

The built in Freemarker caching mechanism fails to properly cache templates when they are retrieved from the classpath. Copying them to the WEB_APP root allows Freemarker to cache them correctly. Freemarker looks at the last modified time of the template to determine if it needs to reload the templates. Resources retrieved from the classpath have no last modified time, so Freemarker will reload them on every request.

(warning) When overriding a theme, copy all necessary templates to the theme directory.

...