Question

I'm using a masterDetail-component to display some stuff. First I had the entire masterDetail-Component nested within a -Tag. After I noticed that I would have to use forms within the masterDetail-component I removed the form tags to avoid nested forms which is not allowed.

<ui:define name="center">
        <p:growl id="infoMessage" sticky="false" />
        <p:layoutUnit position="center" style="border-width: 0px">

            <p:panel id="panel">

                <pe:masterDetail showBreadcrumb="true" selectLevelListener="#{logic.selectLevel}">

                    <f:facet name="header">
                        <p:messages showDetail="false" showSummary="true" />
                    </f:facet>

                    <pe:masterDetailLevel level="1"
                        levelLabel="#{ivy.cms.co('/Labels/Mitarbeiterauswahl')}">
                        <h:panelGrid columns="3" cellpadding="5">

                            <p:outputLabel for="name" value="#{ivy.cms.co('/Labels/Mitarbeiter')}" />
                            <p:inputText id="name" value="#{data.nameSuche}" />
                            <p:commandButton value="#{ivy.cms.co('/Labels/Buttons/Suchen')}"
                                actionListener="#{logic.RD_Suchen}" update="mitarbeitersuche" />

                        </h:panelGrid>

                        <p:dataTable value="#{data.mitarbeiter.rsMitarbeiter}" var="mitarbeiter"
                            id="mitarbeitersuche">
                            <p:column headerText="#{ivy.cms.co('/Labels/Nachname')}">
                                <h:outputText value="#{mitarbeiter['nachnamemita']}" />
                            </p:column>

                            <p:column headerText="#{ivy.cms.co('/Labels/Vorname')}">
                                <h:outputText value="#{mitarbeiter['vornamemita']}" />
                            </p:column>

                            <p:column headerText="#{ivy.cms.co('/Labels/Kostenstellennr')}">
                                <h:outputText value="#{mitarbeiter['nrkost']}" />
                            </p:column>

                            <p:column headerText="#{ivy.cms.co('/Labels/Kostenstelle')}">
                                <h:outputText value="#{mitarbeiter['beschreibungkost']}" />
                            </p:column>

                            <p:column headerText="#{ivy.cms.co('/Labels/email')}">
                                <h:outputText value="#{mitarbeiter['emailmita']}" />
                            </p:column>

                        </p:dataTable>

                    </pe:masterDetailLevel>


                </pe:masterDetail>


            </p:panel>

        </p:layoutUnit>
    </ui:define>

Now an exception is thrown:

MenuItem must be inside a form element

viewId=/instances/13ED0EF71F61E4D5/MitarbeiterdatenJSF.xhtml location=C:\Users\nweis.FREICON\Desktop\xivy5\webapps\ivy\instances\13ED0EF71F61E4D5\MitarbeiterdatenJSF.xhtml phaseId=RENDER_RESPONSE(6)

Caused by: javax.faces.FacesException - MenuItem must be inside a form element at org.primefaces.component.menu.BaseMenuRenderer.encodeMenuItem(BaseMenuRenderer.java:92)

This is really confusing me because in the code example provided by the PrimefacesExtension-Team there is no form-element surounding pe:masterDetail see here. Maybe someone could give me a hand.

Was it helpful?

Solution

We have a form element surrounding pe:masterDetail of course. It is simple not shown in code because the form is in the master template. Sure, MenuItem should be within a form and hence the entire MasterDetail too. MenuItem is a command component and every command component should be within a form.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top