File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes css backbean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "css backbean" Watch "css backbean" New topic

css backbean

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
Hi anybody knows if I could set a new value for a css like this:

color: blue;
font-size: 20px;

I mean

color: #{};
font-size: 20px;

I need set values in a css dinamycally from a database or backbean.

¿Any idea?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16914

I don't know that "clase" is a good name for a class - I got confused thinking you were doing some sort of special operation there - but you can do this, providing you are careful.

If you include the css from a separate CSS file (recommended), the variable substitution will not be done and it won't work. However, you should be able to make it work if you include the CSS inline on the JSF page (not recommend, though).

More commonly, however, people usually either select from a collection of css files ("skinning") or set the class name (or style information) on the tag they which to change styles on - for example, I have a display like so:

The backing bean code is:

Customer surveys are for companies who didn't pay proper attention to begin with.
Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
Thanks for the answer, then for example me would like set the style x, throught back bean but I want that the next time I load the page(from any machine), it shows the styles set in my last setting session. Then I have developed it using a DDBB.

But it is very slow, ¿is no there a way to improve that?

It is sorta covered in the JavaRanch Style Guide.
subject: css backbean
It's not a secret anymore!