Richfaces 4.0 / JSF 2.0:为什么不渲染panelMenu和dropDownMenu?

时间:2012-01-17 09:51:08

标签: jsf richfaces

使用Richfaces 4.0 / JSF 2.0 / Tomcat。我创建了一个页面来渲染panelMenu和dropDownMenu。但是,panelMenu只是呈现为纯文本而dropDownMenu完全不呈现。看屏幕图片: Screen capture

当我尝试使用RichFaces 3.3.3时,它们会正确呈现。但是,我开始收到一个错误,标签h:header在我的其他页面中无法识别。我添加了以下文件: -

  1. RichFaces的组件-API-4.1.0.Final.jar
  2. RichFaces的组件-UI-4.1.0.Final.jar
  3. RichFaces的核-API-4.1.0.Final.jar
  4. RichFaces的核 - IMPL-4.1.0.Final.jar
  5. SAC-1.3.jar
  6. 番石榴r09.jar
  7. cssparser-0.9.5.jar
  8. jsf-api.jar和jsf-impl.jar(2.0)
  9. 我的代码:

        <h:body>
    
        <h:form id="form2">
            <rich:dropDownMenu value="MENU">
                <rich:menuItem value="ITEM1"></rich:menuItem>
                <rich:menuItem value="ITEM2"></rich:menuItem>
            </rich:dropDownMenu>
        </h:form>
        <h:form id="form">
            <h:panelGrid columns="2" columnClasses="cols,cols" width="400">
                <rich:panelMenu style="width:200px" mode="ajax"
                    iconExpandedGroup="disc" iconCollapsedGroup="disc"
                    iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
                    iconCollapsedTopGroup="chevronDown">
                    <rich:panelMenuGroup label="Group 1">
                        <rich:panelMenuItem label="Item 1.1"
                            action="#{panelMenu.updateCurrent}">
                            <f:param name="current" value="Item 1.1" />
                        </rich:panelMenuItem>
                        <rich:panelMenuItem label="Item 1.2"
                            action="#{panelMenu.updateCurrent}">
                            <f:param name="current" value="Item 1.2" />
                        </rich:panelMenuItem>
                        <rich:panelMenuItem label="Item 1.3"
                            action="#{panelMenu.updateCurrent}">
                            <f:param name="current" value="Item 1.3" />
                        </rich:panelMenuItem>
                    </rich:panelMenuGroup>
                </rich:panelMenu>
                <rich:panel bodyClass="rich-laguna-panel-no-header">
                    <a4j:outputPanel ajaxRendered="true">
                        <h:outputText value="#{panelMenu.current} selected" id="current" />
                    </a4j:outputPanel>
                </rich:panel>
            </h:panelGrid>
        </h:form>
    </h:body>
    

    我的web.xml:

    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    
    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>
    
    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>
    <context-param>
        <param-name>org.richfaces.LoadScriptStrategy</param-name>
        <param-value>ALL</param-value>
    </context-param>
    
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    
    <context-param>
        <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
        <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>
    
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    

1 个答案:

答案 0 :(得分:0)

我终于从here得到了答案。有很多问题: -

  1. 原来,RichFaces 4.0重命名了web.xml中指定的一些参数,例如   org.richfaces.SKIN(现为org.richfaces.skin),   org.richfaces.CONTROL_SKINNING(现为org.richfaces.enableControlSkinning)等
  2. 看起来如果没有h:head标签,皮肤就无法使用。
  3. 相当混乱......