0

我正在使用 primefaces 菜单栏,并且根据所选的菜单项,我想在 URL (GET) 中传递一个不同的参数

<ui:composition>
    <h:form rendered="#{facesContext.externalContext.userPrincipal != null}">
        <p:menubar>
            <p:menuitem value="#{msg['menu.home']}" url="/index.xhtml" />
            <p:submenu label="#{msg['menu.maintenance']}" >
                <p:menuitem id="client" value="#{msg['menu.clients']}" action="/person/newPerson?faces-redirect=true" ajax="false" includeViewParams="true">
                     **<f:param name="type" value="client"/>**
                </p:menuitem>
                <p:menuitem id="supplier" value="#{msg['menu.suppliers']}" action="/person/newPerson?faces-redirect=true" ajax="false" >
                    **<f:param name="type" value="supplier"/>**
                </p:menuitem>
            </p:submenu>

This way when the menuitem "client" is selected I would like to use the GET parameter "type=client" in the newPerson.xhtml like so:

<h:outputText value="Parameter: #{param['type']}" />

但是,没有在 URL 中传递任何参数。有人可以告诉我我的代码有什么问题吗?

4

1 回答 1

0

Instead of action attribute try URL

<p:menuitem id="client" value="#{msg['menu.clients']}" url="/person/newPerson?faces-redirect=true&type=client" ajax="false" includeViewParams="true">
</p:menuitem>
于 2013-04-18T20:07:35.920 回答