我已经多次使用Primefaces了。 太好了。 但这次我不知道为什么:
我无法添加咆哮组件,错误是:org.primefaces.component.growl.Growl 无法转换为 org.primefaces.component.api.AutoUpdatable
对于 p:消息也是如此
这可能是由于我的脸上的一些错误。 但是我将其与我之前写的一个成功的facelet进行了比较,我无法弄清楚问题出在哪里。 面孔是问题是(删除p:咆哮,一切顺利):
<body>
<ui:composition template="./../../WEB-INF/master.xhtml">
<ui:define name="top">
<h:outputText value="#{bundle.ListAccountHolderTitle}"></h:outputText>
</ui:define>
<ui:define name="content">
<h:form>
<p:growl id="growl"/>
<p:dataTable value="#{accountHolderBean.items}" var="holder">
<p:column headerText="Type">#{holder.name}</p:column>
</p:dataTable>
<h:panelGrid columns="2">
Type
<h:inputText id="type1" required="true" value="#{accountHolderBean.selected.type}"/>
Name
<h:inputText id="name1" value="#{accountHolderBean.selected.name}"/>
Field
<h:inputText id="field1" accesskey="f" value="#{accountHolderBean.field}"/>
Value
<h:inputText id="val" accesskey="v" value="#{accountHolderBean.val}"/>
All attributes
<h:outputText id="attrs" value="#{accountHolderBean.allAttributes}"/>
</h:panelGrid>
<p:commandLink update="attrs" actionListener="#{accountHolderBean.update}">Update</p:commandLink>
</h:form>
</ui:define>
</ui:composition>
</body>
org.primefaces.component.growl.Growl cannot be cast to org.primefaces.component.api.AutoUpdatable
这表明 Web 应用的运行时类路径中同时具有 PrimeFaces 2.x 和 3.x 库。AutoUpdatable
是在PrimeFaces 3.0中引入的,而Growl
在2.x中已经存在,但直到PrimeFaces 3.0才实现AutoUpdatable
。
清理你的类路径,摆脱有问题的旧PrimeFaces 2.x库。