> Hi,
>
> how can one add a specific css class/style of the label when
> instanciating like:
>
> <s:textfield label="bla" name="commentField" id="commentField" />
>
> I now had to change theme="simple" and add the css class to the <td> of
> the label but with that I can not reference it with the name when a
> fieldError occurred.
>
> I have:
>
> <s:label theme="simple" key="comment" for="commentField" />
>
> and add an error with addFieldError("commentField", "no comment left")
> but that isnt working. The error is diplayed, but the label isnt red or
> got that exclamation mark in a triangle.
>
> Any ideas how to solve that?
>
> Thx!
>
You have several possibilities:
- Stick to simple theme and use <s:fieldError > to display validation
errors. Not recommended as you cannot use some nice features of struts2
- Take another theme that is shipped with struts2 (or a plugin like
jquery- or bootstrap-plugin), see how the generated html looks like and
write your own css rules for that html
- Write your own theme
- Add <s:head /> to your html header, that includes css and js files
required by struts2
regards,
Christoph
This Email was scanned by Sophos Anti Virus