You can use conditional statements in EL.
Assuming that #{bean.name} returns a String:<h:someComponent styleClass="#{bean.name == 'foo' ? 'style1' : 'style2'}" />
Further on please respect the use of letter casing. Instance and variable names starts with lowecase, so also the managed bean name and the property name.