css - RichFaces CSS 不工作

标签 css jsf drop-down-menu richfaces

我正在尝试使用 richfaces 开发我的第一个应用程序,为此我使用了来自 rf 站点的示例。

此时我尝试开发如下链接的下拉菜单

http://showcase.richfaces.org/richfaces/component-...nu&sample=topMenu&skin=classic

但我无法更改栏菜单的颜色。

我想要这个: enter image description here

但是我有这个:

enter image description here

我在 netbeans 工作,并已将 richfaces 添加到 JSF(带有 facelets)元素中。我只是添加了 richfaces 的 jar 和 css 文件,仅此而已。

下面是我的 facelet 模板和我的菜单文件:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="./../../resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="./../../resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
        <title>Facelets Template</title>
    </h:head>

    <h:body>
        <div id="top" >
            <ui:insert name="top">Top</ui:insert>
            <ui:include src="topo.xhtml" />
        </div>
        <div>
            <div id="left">
                <ui:insert name="left">Left</ui:insert>
            </div>
            <div id="content" class="left_content">
                <ui:insert name="content">Content</ui:insert>
            </div>
        </div>
    </h:body>

</html>

topo.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich">

<ui:composition>

    <h:outputStylesheet name="estilo">
        .pic {
        margin-bottom: -4px;
        margin-right: 2px;
        }

        .search .rf-ddm-itm-sel {
        background-color: transparent;
        background-image:none;
        border-color: transparent;
        cursor: default;
        }
   </h:outputStylesheet>
    <h:form>
        <rich:toolbar height="26px">
            <rich:dropDownMenu mode="ajax">
                <f:facet name="label">
                    <h:panelGroup>
                        <h:graphicImage value="../resources/images/icon_client.jpg" styleClass="pic" alt="cliente" />
                        <h:outputText value=" Clientes" />
                    </h:panelGroup>
                </f:facet>
                <rich:menuItem label="Novo Cliente" ></rich:menuItem>
                <rich:menuItem label="Consultar"></rich:menuItem>
            </rich:dropDownMenu> 

        </rich:toolbar>

    </h:form>
       <a4j:outputPanel ajaxRendered="true">
        <h:outputText value="Current Selection: "></h:outputText>
        <h:outputText style="font-weight:bold" value="#{dropDownMenuBean.current}"></h:outputText>
    </a4j:outputPanel>
    <br />

</ui:composition>

</html>

怎么了?

最佳答案

1)如果要使用RichFaces皮肤,则在web.xml

中添加
<context-param>
    <param-name>org.richfaces.skin</param-name>
    <param-value>#{lookAndFeel.skin}</param-value>
        <!-- blueSky, classic, DEFAULT, deepMarine, ruby, emeraldTown -->
</context-param>
<context-param>
    <param-name>org.richfaces.enableControlSkinning</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.enableControlSkinningClasses</param-name>
    <param-value>true</param-value>
</context-param>

2) 如果你想使用你的 css,然后将你的链接从 h:header 移动到模板文件中的 h:body 中,例如这个

<h:body>
    <link rel="stylesheet" type="text/css"
        href="#{request.contextPath}/css/basic.css" media="all" />
</h:body>

关于css - RichFaces CSS 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22466726/

相关文章:

jsf - <p :commandButton> not working when disable ="true" initially

jsf - 如何将每个文件夹中的 index.html 更改为/当我们在浏览器上访问它时

html - 调整浏览器大小时水平滚动不显示

javascript - 隐藏的 Jquery 不适用于 css 动画

javascript - 将当前 margin 值添加到另一个值

html - 如何底部对齐 flex 元素内的元素?

jsf - Mojarra 2.1.29 与 JDK 1.6 不兼容

validation - 使用 bool 数据验证 Flutter 中的日期字段

javascript - 仅使用 JavaScript 在导航栏外部单击后关闭下拉菜单?

c# - DropDownList onChange 在 selectedIndex 0 时不起作用