Struts2 Themes

Version 1.1 by Ken McWilliams on 2012/03/02 19:42

Struts2 supports four different themes: simple, xhtml, css_xhmtl and ajax.

In all my projects I use the simple theme which behaves exactly the way we would expect regular html to behave.  Because I want this theme to apply to my whole application I simply set this value in my struts.xml.  The default theme can be set for a specific tag, the page being rendered, the whole request, session or even globally.  For more detail on themes visit struts.apache.org.

Struts.xml - globally setting the theme to simple

<?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.ui.theme" value="simple" />
</struts>