Pages Navigation Menu

Coding is much easier than you think

How to Override Default Theme in Struts 2 ?

Struts 2 have theme generation functionality due to which it automatically generates Table based HTML code for its tags. This is due the default theme (x_html)
** UPDATE: Struts 2 Complete tutorial now available here.
Other themes are

  • simple
  • css_xhtml
  • ajax

You can change this theme setting to any other theme on tag level, page level or application level as shown below.

1. Tag Level

<s:submit name="clear" action="ClearFormAction" value="Clear" theme="simple" />

2. Page Level

a) Static value

<s:set name="theme" value="'simple'" scope="page"/>

b) Dynamic property

<s:set name="theme" value="%{myTheme}" scope="page"/>


3. Application Level

<constant name="struts.ui.theme" value="simple"/>

Popular Post in Struts 2 :


About Mohaideen Jamil

Am currently working as a Struts 2 Developer in a reputed IT Organisations. I can help you with teaching Core java and Struts 2. Follow me on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.