I am using a JSF data table. One of the columns in the table is the command button.
When this button is pressed, I need to pass several parameters (for example, the value of the selected string) using the language of expression. These parameters must be passed to a managed JSF bean that can execute methods on them.
I used the following code snippet, but the value that I get on the JSF bean is always null.
<h:column> <f:facet name="header"> <h:outputText value="Follow"/> </f:facet> <h:commandButton id="FollwDoc" action="#{usermanager.followDoctor}" value="Follow" /> <h:inputHidden id="id1" value="#{doc.doctorid}" /> </h:column>
Bean Method:
public void followDoctor() { FacesContext context = FacesContext.getCurrentInstance(); Map requestMap = context.getExternalContext().getRequestParameterMap(); String value = (String)requestMap.get("id1"); System.out.println("Doctor Added to patient List"+ value); }
How to pass values ββto a managed JSF bean using a command button?
jsf datatable
user394432
source share