Using the button, you bind the action , which is a method in the bean database, you can set the parameters in the backup bean and read them when you click the button from the method associated with the action . The action method should return a String that will be read by the navigation handler to check whether it needs to go to a new page according to the configuration in faces-config.xml .
<h:form> <h:commandButton value="Press here" action="#{myBean.action}"> <f:setPropertyActionListener target="#{myBean.propertyName1}" value="propertyValue1" /> <f:setPropertyActionListener target="#{myBean.propertyName2}" value="propertyValue2" /> </h:commandButton> </h:form>
Bean support:
package mypackage; public class MyBean {
This example is taken from here (BalusC blog, maybe it will come and tell you to check this link, but I'm faster !: p)
Of course, to achieve this, the bean must be set as session scoped . If you want it to be request scoped , you can follow the steps here
pakore
source share