开发者

dynamic CSS in JSF

开发者 https://www.devze.com 2023-03-22 08:22 出处:网络
I read this article about dyna开发者_如何学Gomic CSS. I would like to generate CSS based on db parameters.

I read this article about dyna开发者_如何学Gomic CSS.

I would like to generate CSS based on db parameters.

Something similar to <link rel="stylesheet" href="mydynamicCss.ashx?cssCode=mainPage" type="text/css"/>

What is the best way to implement it in JSF?

I am using JSF2.0


I would rather use an extra servlet for this purpose, possibly something using velocity/freemarker or maybe there are existing libraries supporting css generation. The href link would be mapped to this servlet instead of JSF servlet. I haven't really seen a css taglib for JSF.


I don't truly understand what you mean, but we create "dynamic" CSS by using conditions.

For instance

<a:repeat var="foo" value="#{foos}">
  <li class="#{foo % 2 == 0?'odd':'even'}">
   ....
</a:repeat>
0

精彩评论

暂无评论...
验证码 换一张
取 消