How can I pass selected row to commandLink inside dataTable or ui:repeat?

前端 未结 4 1816
情话喂你
情话喂你 2020-11-21 06:29

I\'m using Primefaces in a JSF 2 application. I have a , and instead of selecting rows, I want the user to be able to directly execute variou

4条回答
  •  心在旅途
    2020-11-21 06:57

    Thanks to this site by Mkyong, the only solution that actually worked for us to pass a parameter was this

    
        
    
    

    with

    public String editAction() {
    
      Map params = 
                FacesContext.getExternalContext().getRequestParameterMap();
      String idString = params.get("myId");
      long id = Long.parseLong(idString);
      ...
    }
    

    Technically, that you cannot pass to the method itself directly, but to the JSF request parameter map.

提交回复
热议问题