Question

How do I pass the value in my dataTable to another jsf page? I managed to pass the value by using f:param but I have no clue how to get the data in dataTable and pass the value.

<p:outputPanel id="panelSysMenuList">
    <p:dataTable id="dtSysMenu" paginator="true" paginatorPosition="bottom" paginatorAlwaysVisible="true"
                 var="menu" styleClass="panel-list"  filteredValue="#{menuController.filteredList}"
                 value="#{menuController.resultList}" emptyMessage="#{msg.noRecordsFound}"
                 rows="#{menuController.datatableMaxResult}" selection="#{menuController.selectMenu}"
                 widgetVar="widVarTable" rowKey="#{menu}" selectionMode="single"> 
        <p:column sortBy="#{menu.admenuPK.parentNode}" >
            #{menu.admenuPK.parentNode}
        </p:column>
        <p:column  sortBy="#{menu.admenuPK.node}" >
            #{menu.admenuPK.node}
        </p:column>
        <p:column sortBy="#{menu.nodeDesc}" >
            #{menu.nodeDesc}
        </p:column>
        <p:column sortBy="#{menu.className}" >
            #{menu.className}
        </p:column>
        <p:column  sortBy="#{menu.nodeRemark}" >
            #{menu.nodeRemark}
        </p:column>
    </p:dataTable>
</p:outputPanel>

<p:button id="btnAdd2" value="#{msg.sysMenuAdd}"   icon="ui-icon-plus" styleClass="action-buttons"  outcome="MenuMaint">
    <f:param name="parentNode" value="#{menuController.parentNode}" />
    <f:param name="node" value="#{menuController.selectMenu}" />
</p:button>

My MenuMaint

<f:metadata>
    <f:viewParam name="parentNode" value="#{menuMaintController.parentNode}" />
    <f:viewParam name="node" value="#{menuMaintController.node}" />
</f:metadata>

Or is that anyway that I can do? BTW, I am using ViewScoped Thanks in advance!

Was it helpful?

Solution

I have solved my question by adding the param at the end of my URL

MenuMaint?parentNode=parentNode&node=selected

at the managed bean of MenuMaint, I will get the param using

FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("parentNode")

this enable for me to get the value in another way than f:param

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