简体   繁体   English

如何将richfaces标签添加到jsf页面?

[英]How to add richfaces tag to a jsf page?

I am following the tutorials and examples at http://livedemo.exadel.com/richfaces-demo/richfaces/scrollableDataTable.jsf?tab=usage&cid=40889 and i am using richfaces 4.0 . 我正在按照http://livedemo.exadel.com/richfaces-demo/richfaces/scrollableDataTable.jsf?tab=usage&cid=40889上的教程和示例进行操作,并且我正在使用richfaces 4.0。 Now i am trying to create a scrollable data table. 现在,我试图创建一个可滚动的数据表。 I inserted the sample code to my jsf page. 我将示例代码插入了我的jsf页面。 Here it is: 这里是:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:rich="http://richfaces.org/rich">

    <style>
        .scrolls{
            width:300px;
            height:200px;
            overflow:auto;
        }
    </style>    
    <h:form>
        <rich:spacer height="30" />
        <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px" 
            width="700px" id="carList" rows="40" columnClasses="col"
            value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
            sortOrder="#{dataTableScrollerBean.order}"
            selection="#{dataTableScrollerBean.selection}">

            <rich:column id="make">
                <f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
                <h:outputText value="#{category.make}" />
            </rich:column>
            <rich:column id="model">
                <f:facet name="header"><h:outputText styleClass="headerText" value="Model" /></f:facet>
                <h:outputText value="#{category.model}" />
            </rich:column>
            <rich:column id="price">
                <f:facet name="header"><h:outputText styleClass="headerText" value="Price" /></f:facet>
                <h:outputText value="#{category.price}" />
            </rich:column>
            <rich:column id="mileage">
                <f:facet name="header"><h:outputText styleClass="headerText" value="Mileage" /></f:facet>
                <h:outputText value="#{category.mileage}" />
            </rich:column>
            <rich:column width="200px" id="vin">
                <f:facet name="header"><h:outputText styleClass="headerText" value="VIN" /></f:facet>
                <h:outputText value="#{category.vin}" />
            </rich:column>
            <rich:column id="stock">
                <f:facet name="header"><h:outputText styleClass="headerText" value="Stock" /></f:facet>
                <h:outputText value="#{category.stock}" />
            </rich:column>
        </rich:scrollableDataTable>
        <rich:spacer height="20px"/>
        <a4j:commandButton value="Show Current Selection" reRender="table" 
            action="#{dataTableScrollerBean.takeSelection}" 
            oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
    </h:form>
    <rich:modalPanel id="panel" autosized="false" keepVisualState="false" width="315" height="230">
            <f:facet name="header">
                <h:outputText value="Selected Rows"/>
            </f:facet>
            <f:facet name="controls">
                <span style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('panel')">X</span>
            </f:facet>
        <h:panelGroup layout="block" styleClass="scrolls">
        <rich:dataTable value="#{dataTableScrollerBean.selectedCars}" var="sel" id="table">
            <rich:column>
                <f:facet name="header"><h:outputText value="Make" /></f:facet>
                <h:outputText value="#{sel.make}" />
            </rich:column>
            <rich:column id="model">
                <f:facet name="header"><h:outputText value="Model" /></f:facet>
                <h:outputText value="#{sel.model}" />
            </rich:column>
            <rich:column id="price">
                <f:facet name="header"><h:outputText value="Price" /></f:facet>
                <h:outputText value="#{sel.price}" />
            </rich:column>
            <rich:column id="mileage">
                <f:facet name="header"><h:outputText value="Mileage" /></f:facet>
                <h:outputText value="#{sel.mileage}" />
            </rich:column>
            <rich:column id="stock">
                <f:facet name="header"><h:outputText value="Stock" /></f:facet>
                <h:outputText value="#{sel.stock}" />
            </rich:column>
        </rich:dataTable>
        </h:panelGroup>
    </rich:modalPanel>
</ui:composition>

The problem is, netbeans says 问题是,netbeans说

The component library http://richfaces.org/rich does not contain component scrollableDataTable

To fix this, i think i need to add org.richfaces.taglib.ScrollableDataTableTag tag to the page. 要解决此问题,我认为我需要在页面上添加org.richfaces.taglib.ScrollableDataTableTag标签。 But i do not know how to add tag to a jsf page. 但是我不知道如何在jsf页面中添加标签。 I tried: 我试过了:

<ui:composition xlmns:u="org.richfaces.taglib.ScrollableDataTableTag">

but it gives an error saying that: 但它给出一个错误,说明:

Fatal Error: Open quote is expected for attribute "{1}" associated with an  element type  "xlmns:u".

From line 14, column 9; 从第14行第9列; to line 14, column 33 到第14行,第33列

Further processing of the file may be significantly affected by this fatal error. Please fix the problem before continuing editing of this file!

Undeclared component xlmns:u=org.richfaces.taglib.ScrollableDataTableTag"

So how can i add this tag, or do i have to do another thing to use scrollable data table? 那么,如何添加此标记,还是必须做另一件事才能使用可滚动数据表? Can anyone help? 有人可以帮忙吗?

Thanks 谢谢

正如Alexandre Lavoie所说,这是因为版本不同,现在正在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM