Here is a small helper class I wrote to do what you are asking.
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
public class UIHelper {
public UIHelper() {
}
public static Object getReqMapObj(String obj) {
return FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(obj);
}
public static void addMessage(String componentName, String message) {
FacesContext.getCurrentInstance().addMessage(componentName, new FacesMessage(message));
}
}
To use it, it looks like this:
public String deleteAction() {
someObject = (SomeObject) UIHelper.getReqMapObj("varobject");
return null;
}<x:dataTable var="varobject" value="#{OrderCtl.partsList}">
<h:column>
<f:facet name="header">
<h:outputText value="Part Number"/>
</f:facet>
<h:outputText value="#{varobject.id}" styleClass="copy"/>
</h:column> <h:column>
<f:facet name="header">
<h:outputText value="Action"/>
</f:facet>
<h:commandButton action="#{OrderCtl.deleteAction}"/>
</h:column> </x:dataTable>
HTH, Aaron Bartell
Ray Clark wrote:
I'm sure this must have been asked before but I can't find it in the archives. So please forgive me if it has been asked before.
I have a dataTable with a commandButton rendered on each row. When the commandButton is pressed I need it's managed bean method to know which row the button was pressed for. So how can the method know which row to process?
Thanks, Ray
__________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo

