Like many elements on a Web page, JSF components can be assigned a style class with the class attribute. A style class, not to be confused with a Java™ class, is a group of zero to many commands that describes the appearance of an element on a Web page. Style classes are defined with the Cascading Style Sheets language, a language that can control many different aspects of the appearance of a Web page.
You can change the style class of a JSF component on a Faces JSP file from one class to another. To make smaller changes to a JSF component's style, such as changing the text color, see Changing the style of a JSF component. For more information about styles and style classes, see Defining page styles for a Web site - overview.
import com.ibm.egl.jsf.*
text1 HtmlInputText; text1 = myViewRoot.findComponent("form1:text1");
text1.setStyleClass("errorField");
<input id="form1:text1" type="text" name="form1:text1" class="errorField" />
Related concepts
JSF component tree
viewRootVar property
Related tasks
Adding JSF component interface support to an EGL Web project
Accessing a JSF component from a pageHandler
Changing the style of a JSF component
Changing the target of a JSF link
Enabling or disabling JSF components
Setting the size of a JSF image
Setting event handlers for a JSF component
Setting JSF data table propertiesDefining page styles for a Web site - overview
Related reference
Component tree access parts