You can use a tr:setActionListener with pageFlowScope. This puts the
parameter in a map that is accessible off of the request. 


<h:commandButton value="Show more" action="showEmployee">
  <tr:setActionListener from="#{employee}"
                        to="#{pageFlowScope.employeeDetail}"/>
</h:commandButton> 

The following link describes the proces in detail. 

http://myfaces.apache.org/trinidad/devguide/communicatingBetweenPages.html


Bob








-----Original Message-----
From: jvnk [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 14, 2008 6:13 PM
To: [email protected]
Subject: Send parameter via <h:commandButton


How can I send parameter using <h:commandButton.

Loop thru all the employees and display in the table. When I click on the
employee name, I want the respective emp id to be passed to the managed
bean.

I read that we can't use <f:param in <h:commandButton. How can I achieve
this functionality.

<f:view>

        <h:form id="srchrsltsForm">

                <h:dataTable id="srchrslts" value="#{subSearchBean.empInfo}"
var="empResults">

                        <h:column>

                                <f:facet name="header"><h:outputText
value="{empResults.empName}"/></f:facet>

                                <h:commandButton value="Employee Name"
action="#{subSearchBean.empAction}">

                                        <f:param value="empid"
name="#{empResults.empID}"/>

                                </h:commandButton>

                        </h:column>

                </h:dataTable>

        </h:form>

</f:view>


Thanks,
Nag

--
View this message in context:
http://www.nabble.com/Send-parameter-via-%3Ch%3AcommandButton-tp18991822p189
91822.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to