0

Primefaces(selectoneMenu、comandlink 和 inplace)无法在 chromium 浏览器上运行请参阅下面的代码,让我知道我在这里做错了什么。selectOneMenu 仅显示第一个元素(单击下拉菜单时未显示全部) commondlink 和 inplace 也不起作用。firefox 17.0.1 工作正常,但在 19.0.2 中不行。这很奇怪。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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:p="http://primefaces.org/ui">


       <h:head>
          <title>Facelet Title</title>
       </h:head>
       <h:body>

          <h:outputText value="Basic Usage: " />

          <h:panelGrid columns="3" styleClass="formpanel" rowClasses="prop" columnClasses="name,value,message">
             <h:outputLabel for="selectLocation">Location:</h:outputLabel>
             <h:form>
                <p:selectOneMenu id="selectLocation" value="#{assetManager.currentLocation}">
                   <f:selectItems value="#{assetManager.selectItemManagedLocations}" />
                      <p:ajax update=":locationform:assetlist" />
                </p:selectOneMenu>
             </h:form>

          </h:panelGrid>

       <h:form id ="locationform">
             <p:dataTable emptyMessage="No assets for branch."
                          value="#{assetManager.assetsByLocation}" var="a" styleClass="workflowtable" 
                          id="assetlist" >
                <f:facet name="header" >
                   Assets for #{assetManager.currentLocationName}
                </f:facet>

             <p:column id="lftype" width="95px">
                <f:facet name="header">
                   <h:outputText value="Type"></h:outputText>
                </f:facet>
                <h:outputText value="#{a.model.make.type.description}"></h:outputText>
             </p:column>


             <p:column id="lfmake" width="110px">
                <f:facet name="header">
                   <h:outputText value="Make"></h:outputText>
                </f:facet>
                <h:outputText value="#{a.model.make.description}"></h:outputText>
             </p:column>


             <p:column id="lfmodel" width="110px">
                <f:facet name="header">
                   <h:outputText value="Model"></h:outputText>
                </f:facet>
                <h:outputText value="#{a.model.description}"></h:outputText>
             </p:column>

             <p:column id="lfserialNo" width="110px">
                <f:facet name="header">
                   <h:outputText value="Serial No"></h:outputText>
                </f:facet>
                <h:outputText value="#{a.serialNo}"></h:outputText>
             </p:column>


             <p:column id="lfstatus" width="90px">
                <f:facet name="header">
                   <h:outputText value="Status"></h:outputText>
                </f:facet>


                   <p:selectOneMenu  value="#{a.status}" style="width: 60px;" >
                      <f:selectItems value="#{assetManager.assetStatuses}" />
                      <p:ajax listener="#{assetManager.updateStatus(a)}" />
                   </p:selectOneMenu>


             </p:column>


             <p:column id="lfaddedby" width="100px">
                <f:facet name="header">
                   <h:outputText value="Added By"></h:outputText>
                </f:facet>
                <h:outputText rendered="#{assetHelper.getAddLog(a) eq null}" value="Unknown"></h:outputText>
                <h:outputText rendered="#{assetHelper.getAddLog(a) ne null}" value="#{assetHelper.getAddLog(a).employeeName}"></h:outputText>
             </p:column>


             <p:column id="lfaction" width="50px">
                <f:facet name="header">
                   <h:outputText value="Action"></h:outputText>
                </f:facet>


                   <p:commandLink style="margin-right:20px;"  action="/asset/edit.xhtml?faces-redirect=true">  
                      <f:setPropertyActionListener target="#{maintenanceManager.asset}" value="#{a}" />
                      <h:graphicImage value="/images/EditSmall.png" />
                   </p:commandLink>  


             </p:column>


             <p:column id="lfcomments" width="210px" >
                <f:facet name="header">
                   <h:outputText value="Comments"></h:outputText>
                </f:facet>

                   <p:inplace id="ajaxCommentsInplace" editor="true" emptyLabel="Click here to add comments">
                      <p:inputText value="#{a.comments}"
                                   required="false" label="text" id ="commentsText"/>
                      <p:ajax event="save" listener="#{assetManager.updateStatus(a)}" />

                   </p:inplace>

             </p:column>


          </p:dataTable>
       </h:form>
       </h:body>
    </html>
4

1 回答 1

0

在视图中包含所有组件,形成层次结构。IE,

<!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:p="http://primefaces.org/ui">

    <f:view>
        <h:head />
        <h:body>
            <h:form>
                <p:somecomponentofyourchoice>
            </h:form>
        </h:body>
    </f:view>
</html>

那一定有帮助。

于 2013-03-20T12:50:40.877 回答