Versions Compared

Key

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

...

For example, this Struts 2 select tag:

Code Block
HTMLhtmlHTML
html
titleStruts 2 Select Tag

<s:select key="personBean.sport" list="sports" />

generates this HTML markup:

Code Block
HTMLhtmlHTML
html
titleHTML Created By Struts 2 Select Tag

<tr>
<td class="tdLabel">
<label for="save_personBean_sport" class="label">Favorite sport:</label>
</td>
<td>
<select name="personBean.sport" id="save_personBean_sport">
    <option value="football">football</option>
    <option value="baseball">baseball</option>
    <option value="basketball" selected="selected">basketball</option>
</select>
</td>
</tr>

...

Load this style sheet in your browser (in the example application the link is http://localhost:8080/themes/struts/xhtml/styles.css if your Servlet container is running on localhost, port 8080). You’ll see the following:

Code Block
HTMLhtmlHTML
html
titlestyles.css

.label {font-style:italic; }
.errorLabel {font-style:italic; color:red; }
.errorMessage {font-weight:bold; color:red; }
.checkboxLabel {}
.checkboxErrorLabel {color:red; }
.required {color:red;}
.tdLabel {text-align:right; vertical-align:top; }

...

You can override the above selectors by including the same selectors in your page’s head section. For example add the following to the head section of edit.jsp.

Code Block
HTMLhtmlHTML
html
titleOverride Label Style

<style type="text/css">
  .label {color:blue; font-style:normal; font-weight:bold}
</style>


...

I then modified the checkboxlist.ftl in the KUTheme folder to be:

Code Block
HTMLhtmlHTML
html
titleModified checkboxlist.ftl

<#include "/${parameters.templateDir}/xhtml/controlheader.ftl" />
<#include "/${parameters.templateDir}/KUTheme_simple/checkboxlist.ftl" />
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>

...