2

我在我的项目中使用 primefaces。当我在其中一个 .xhtml 页面中使用该组件时,我收到以下错误消息:

“标签库支持命名空间:http ://primefaces.org/ui,但没有为名称定义标签:panelMenu”

我正在使用 primefaces 3.3.1 jar 。

代码片段:

<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">
<h:head>
    <title>Welcome to OTV_JSF_Spring_Hibernate_Project</title>
<style type="text/css">
h1{
    font-family:"Times New Roman";
    font-size:7px;
  }

pre{
    font-family:"Times New Roman";
    font-size:25px;
    font-style:bold;
    align:center;
}
</style>
</h:head>
<h:body>
    <h:form>

         <p:layout style="min-width:300px;min-height:700px;" id="layout">  
             <p:layoutUnit position="east" resizable="true" size="300" minSize="40" maxSize="300">  
               <p:panelMenu style="width:200px">  
                     <p:submenu label="Create Form">  
                        <p:menuitem value="New Form" actionListener="" icon="ui-icon-disk" />  
                        <p:menuitem value="Current Form" actionListener=""  icon="ui-icon-arrowrefresh-1-w" />  
                        <p:menuitem value="Form Templates" actionListener=""  icon="ui-icon-arrowrefresh-1-w" />
                     </p:submenu>  

                <p:submenu label="Publish Form" >  
                    <p:menuitem value="Home" actionListener=""  ajax="false" icon="ui-icon-close"/>  
                    <p:menuitem value="Docs" actionListener=""  ajax="false" icon="ui-icon-close"/>  
                </p:submenu>  
                 <p:submenu label="Users Profile">  
                         <p:menuitem value="Add New User" actionListener=""  ajax="false" icon="ui-icon-close"/>  
                         <p:menuitem value="Edit User Profile" actionListener=""  ajax="false" icon="ui-icon-close"/>
                         <p:menuitem value="Remove Users" actionListener=""  ajax="false" icon="ui-icon-close"/>
                         <p:menuitem value="View Users Report" actionListener=""  ajax="false" icon="ui-icon-close"/>
                     </p:submenu>  
                <p:separator />  

            </p:panelMenu>   
       </p:layoutUnit>  

         <p:layoutUnit position="center">  
         <h1><font size = "6"><h:outputLabel for="createform" value="Create New Form"/></font></h1>
         <hr width="98%"></hr>
             <table> 

             <tr>
                <td width="30%"><pre><h:outputLabel for="name" value="Name of the form : " /></pre></td>
                <td align="left"><p:inputText id="name" value="#{questionMB.formName}" label="Name of the form">
                </p:inputText>
                    <p:message id="formMsg" for="name" display="icon"/> 

                </td>
             </tr>   
              <tr>
                <td width="30%"><pre><h:outputLabel for="desc" value="Description of the form : " /></pre></td>
                <td align="left"><p:inputTextarea rows="4" cols="60" value="#{questionMB.formDesc}"/>
                </td>
             </tr>            
             <tr>
              <td width="30%"><pre><h:outputLabel for="question" value="Question : " /></pre></td>
                <td align="left">
                    <p:accordionPanel>  
    <p:tab title="Godfather Part I">  
        <h:panelGrid columns="2" cellpadding="10">  

           <p:inputText id="question" value="#{questionMB.questionText}">
                        <f:validateLength minimum="5" /> 
                        <p:ajax event="blur" update="questionMsg" />
                    </p:inputText>
                    <p:message id="questionMsg" for="question" display="icon"/> 
        </h:panelGrid>  
    </p:tab>  
   </p:accordionPanel>
                </td> 
             </tr>
              <tr>
                <td width="30%"><pre><h:outputLabel for="answer" value="Answer Type : " /></pre></td>
                <td align="center">
      <h:panelGrid columns="2" rows="1" style="margin-bottom:10px" cellpadding="5">  
            <p:selectOneRadio id="options" value="#{questionMB.answerType}">  
            <f:selectItem itemLabel="Text field" itemValue="Text field" />  
            <f:selectItem itemLabel="Combo box" itemValue="Combo box" />  
            <f:selectItem itemLabel="Radio button" itemValue="Radio button" />  
            <f:selectItem itemLabel="Check box" itemValue="Check box" />
            <f:selectItem itemLabel="Date box" itemValue="Date box" /> 
            <f:selectItem itemLabel="Y/N Button" itemValue="Y/N Button" />
             </p:selectOneRadio>  
     </h:panelGrid>  
                </td>
             </tr>
             <tr></tr><tr></tr><tr></tr>

             <tr>
                <td></td><td></td>
                <td><p:commandButton id="addNewQuestion" value="Add New Question" action="#{questionMB.addNewQuestion}" ajax="true"/>
               </td>
             </tr> 
             <tr>
                <td></td><td></td>
                <td><p:commandButton id="addQuestion" value="Save" action="#{questionMB.addQuestion}" ajax="true"/>
                <p:commandButton id="submitQuestion" value="Submit" action="#{questionMB.saveandsubmitForm}" ajax="false"/></td>
             </tr>
             </table> 
         </p:layoutUnit>  
</p:layout>   


    </h:form>
</h:body>

</html>
4

1 回答 1

2

您收到该错误是因为 p:panelMenu 不在 3.3.1 版本中。它在 3.4 中引入。在此处查看 3.3.1 的文档

于 2012-09-11T13:55:24.493 回答