我在尝试使用 PrimeFaces 使每一行都可编辑时收到一条错误消息。我在网上查了很多人都在使用这个。但是,当我尝试创建一个包含可以编辑每一行的报告的页面时。我收到 Event:rowEdit 不支持的错误。有人可以指出我的错误或我需要在我的 XHTML 文件中包含的内容。或者,如果我做的事情完全正确。这张表有很多数据,这就是我采用这种方法的原因
以下是有关我的设置的附加信息:
- 玻璃鱼 v3
- JPA2.1
- PrimeFaces3.5(我已经将 jar 包含在我的项目的构建路径中,因为其他报告页面正在努力确认 primefaces 正在工作)
- EJB 3.1
这是我的 XHTML 代码
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:p="http://primefaces.org/ui">
<f:metadata>
<f:viewParam name="userId" value="#{loginBean.username}"></f:viewParam>
</f:metadata>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="./css/PageLayout.css" rel="stylesheet" type="text/css" />
<title>Edit Lord of Data Entries</title>
</h:head>
<h:body>
<div style="background-color: #205a8c; width: auto; height: 60px">
<h3>Edit Lord Of Data</h3>
</div>
<div id="breadcrumb" align="left">
<h:form>
<p:breadCrumb>
<p:menuitem value="Home" url="home.jsf"></p:menuitem>
<p:menuitem value="Home" url="home.jsf"></p:menuitem>
<p:menuitem value="Users" url="reportUsers.jsf"></p:menuitem>
<p:menuitem value="Groups" url="reportGroups.jsf"></p:menuitem>
<p:menuitem value="User's Group" url="reportUserGroup.jsf"></p:menuitem>
</p:breadCrumb>
</h:form>
</div>
<h:form id="form">
<p:growl id="messages" showDetail="true"></p:growl>
<p:dataTable var="myReport"
value="#{lordOfDataAdminManagedBean.lodAdmin_list}" id="lodlist"
editable="true" paginator="true"
rows="500"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="500,1000,5000">
<f:facet name="header"> Lord Of Data Report</f:facet>
<p:ajax event="rowEdit"
listener="#{lordOfDataAdminManagedBean.onEditListener}"></p:ajax>
<p:ajax event="rowEditCancel"
listener="#{lordOfDataAdminManagedBean.onCancel}"></p:ajax>
<p:column>
<p:rowEditor></p:rowEditor>
</p:column>
<p:column headerText="Row Id">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.rowId}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.rowId}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Group Id">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.security}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.security}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Type">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.type}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.type}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Auto">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.auto}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.auto}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Access">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.access}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.access}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Comment">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.comment}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.comment}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD1 Domain">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD1Domain}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD1Domain}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD1 User">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD1User}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD1User}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD1 Mail">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD1Mail}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD1Mail}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD1 Display Name">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD1DisplayName}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD1DisplayName}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD1 Cost Center">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD1CostCenter}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD1CostCenter}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD2 User">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD2User}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD2User}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD2 Mail">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD2Mail}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD2Mail}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD2 Display Name">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD2DisplayName}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD2DisplayName}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD2 Cost Center">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD2CostCenter}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD2CostCenter}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Domain1">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.domain1}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.domain1}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="RechteGruppe Read">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.rechteGruppeRead}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.rechteGruppeRead}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="AuthentifizierteBenutzer">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.authentifizierteBenutzer}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.authentifizierteBenutzer}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="LOD2 Domain">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.LOD2Domain}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.LOD2Domain}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Email Send Status">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.emailSendStatus}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.emailSendStatus}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Email Feedback">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.emailFeedback}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.emailFeedback}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Comment1">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.comment1}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.comment1}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Comment2">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.comment2}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.comment2}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Comment 3">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.comment3}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.comment3}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Username">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{myReport.username}"></h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{myReport.username}"></p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
用于处理编辑功能的托管 Bean 代码片段
public void onEditListener(RowEditEvent event) {
FacesMessage msg = new FacesMessage("Edited");
try {
Lodreport mydata = (Lodreport) event.getObject();
if (mydata == null) {
System.out.println("No data input found");
} else {
lODBR.updateReport(mydata);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
} catch (Exception e) {
}
}
public void onCancel(RowEditEvent event) {
FacesMessage msg = new FacesMessage("Cancelled");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
错误堆栈跟踪
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.view.facelets.TagException: /editNewLODAdmin.xhtml @44,7 <p:ajax> Event:rowEdit is not supported.
at org.primefaces.component.behavior.ajax.AjaxBehaviorHandler.applyAttachedObject(AjaxBehaviorHandler.java:149)
at org.primefaces.component.behavior.ajax.AjaxBehaviorHandler.apply(AjaxBehaviorHandler.java:127)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:223)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)