尝试将p:menuitem添加到菜单时遇到问题。以下代码是菜单栏的文件,该文件将包含在其他网页中。
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ps="http://primefaces.org/spark"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:outputStylesheet name="css/spark-layout-blue.css" library="spark-layout" />
<h:form>
<ps:menu id="layout-menu">
<p:submenu label="Opções" >
<p:menuitem />
</p:submenu>
</ps:menu>
</h:form>
我把它放在p:menuitem中并不重要,当我尝试运行它时,我得到了这个:
HTTP Status 500 - org.primefaces.model.menu.MenuItem.getClientId()Ljava/lang/String;
type Exception report
message org.primefaces.model.menu.MenuItem.getClientId()Ljava/lang/String;
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.primefaces.model.menu.MenuItem.getClientId()Ljava/lang/String;
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause
java.lang.NoSuchMethodError: org.primefaces.model.menu.MenuItem.getClientId()Ljava/lang/String;
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeElement(SparkMenuRenderer.java:87)
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeElements(SparkMenuRenderer.java:77)
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeSubmenu(SparkMenuRenderer.java:264)
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeElement(SparkMenuRenderer.java:115)
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeElements(SparkMenuRenderer.java:77)
org.primefaces.spark.component.menu.SparkMenuRenderer.encodeMarkup(SparkMenuRenderer.java:59)
org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:105)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903)
javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1896)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:451)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
如果我关闭p:menuitem,它会正常运行。
任何帮助?