如何设置PrimeFaces主题? [英] how to set a PrimeFaces theme?

查看:208
本文介绍了如何设置PrimeFaces主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图让我的PrimeFaces(v2.1)应用程序使用其他主题.

I'm trying to get my PrimeFaces (v2.1) app to use a different theme.

我下载了vader-1.0.0.jar并将其放在我的WEB-INF/lib文件夹中.

I downloaded vader-1.0.0.jar and put it in my WEB-INF/lib folder.

我在我的web.xml中添加了以下内容:

I added the following to my web.xml:

<context-param>   
  <param-name>primefaces.THEME</param-name>
  <param-value>vader</param-value> 
</context-param>

但是当我运行该应用程序时,主题不会改变.

But when I run the app, the theme does not change.

还有其他我想念的东西吗?

Is there something else I'm missing?

推荐答案

您可以像这样动态定义主题:

You can define the theme dynamically like that:

web.xml:

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>#{themeBeam.applicationTheme}</param-value>
</context-param>

豆:

@ApplicationScoped
@ManagedBean
public class ThemeBean {

    public String getApplicationTheme() {
        return "dark-hive";
    }

}

这篇关于如何设置PrimeFaces主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆