aspose file tools*
The moose likes JSF and the fly likes how to change style of h:messages in code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to change style of h:messages in code" Watch "how to change style of h:messages in code" New topic
Author

how to change style of h:messages in code

Balaji Kadam
Ranch Hand

Joined: Apr 27, 2010
Posts: 31

Hi all,

in my jsf page i have added message using h:messages which will show message for all component including info and error messages.

but i want info messages to be display as blue and error as red.

i was trying to apply css class but it shows same for all messages

anybody know how to do this?

Thanks
Balaji
Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

Hi,

The '<h:messages />' component has the attributes 'infoClass' and 'errorClass' class you could use.

Ta


OCA7
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

As a general rule, anything that affects appearances in JSF is handled by CSS. JSF figured that there was already something that worked, so why re-invent it?

Of course, JSF View Definition Language is a higher-level VDL than raw HTML is, so there are often specialized sub-component CSS attributes such as the ones that Louis mentioned.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to change style of h:messages in code