Primefaces(selectoneMenu,comandlink和inplace)不在Chrome浏览器上工作 请看下面的代码,让我知道我在这里做错了什么。 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>
答案 0 :(得分:0)
在视图中包含所有组件,表单层次结构。即,
<!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>
这一定有帮助。