Versions Compared

Key

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

...

In the example application there is a folder named src/main/webapp/template/KUTheme (for the Maven version, for the Ant version the path is WebContent/template/KUTheme). In that folder is a checkboxlist.ftl, the contents of which I originally copied from the checkboxlist.ftl that is in the templates.xhtml folder from the struts 2 core jar.

...

In edit.jsp change the value of the theme attribute to be theme="KUTheme" for the Struts 2 checkboxlist tag. Keep the theme attribute value for the s:form tag as xhtml.

In the deployed web application, Struts 2 will first look for a tag's template in web root/template/theme name and if it doesn't find the template there it will use the default template that is part of the Struts 2 core jar. Since we've added a template folder to the application's web root, now when Struts 2 creates the HTML to display the checkboxlist tag it will use the template that is in the KUTheme folder (which tells it to use the checkboxlist.ftl file that is in the KUTheme_simple folder instead of the one in the template.simple folder that is part of the Struts 2 core Jar).

...