Pages Navigation Menu

Coding is much easier than you think

How to Override Default Theme in Struts 2 ?

theme
 
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