Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add CSS to struts2 tags

I am using struts2 to build a web application and I use struts2 tags extensively. I am not able to apply CSS styles to my struts2 textfields, buttons, labels etc. What is the trick for setting CSS rules to struts2 UI components.

like image 585
Anand Avatar asked Nov 29 '22 19:11

Anand


1 Answers

The struts2 tags have two attributes that are used for this, the cssClass and the cssStyle attributes. The cssClass attribute takes the name of a class that you create in your CSS file. The cssStyle attribute take a string representing CSS style. E.g.

 <s:checkbox cssClass="mycheckbox" label="checkbox test" name="checkboxField1" value="aBoolean" fieldValue="true"/>

and

  <style>
      .mycheckbox{
        /* Your style here */
      }

  </style>
like image 169
Vincent Ramdhanie Avatar answered Dec 09 '22 11:12

Vincent Ramdhanie