I need to change the color of one character in this label specifically the *
.
This will need to be changed for several sections, but not changed for many others
By default Struts2 uses themes (XHTML by default) to generate common HTML MarkUp for the elements.
As pointed out by @AleksandrM's comment, requiredLabel
attribute would generate a span with the asterisk in it, that you can style with CSS.
Be sure to give an id
to elements by yourself, or Struts will generate an unique one by himself that would be difficult to handle (form name _ elementname plus a number or something like that).
Then this
will generate the following HTML:
that you can style easily with:
Running example