How to pass action parameter from jsf pages to Bean class ?
1-<f:setPropertyActionListener >
1- it have only two attribute
1) target
2) value
2-target attribute is used to set value in the backing bean .and value attribute is hold the value which target used to set in the backing bean .
3-this is work on the both action and actionListener case .
<h:form>
<h:commandButton value="Submit" action="#{jsf.action}">
<f:setPropertyActionListener target="#{jsf.name1}" value="value1" />
<f:setPropertyActionListener target="#{jsf.name2}" value="value2" />
</h:commandButton>
</h:form>
1) target
2) value
2-target attribute is used to set value in the backing bean .and value attribute is hold the value which target used to set in the backing bean .
3-this is work on the both action and actionListener case .
<h:commandButton value="Submit" action="#{jsf.action}">
<f:setPropertyActionListener target="#{jsf.name1}" value="value1" />
<f:setPropertyActionListener target="#{jsf.name2}" value="value2" />
</h:commandButton>
</h:form>
2-<f:attribute>
1-it also have two attribute
1)name
2)value
2-value is use to hold the value if you want to used this value then you can access using name .
3-This is work on the only actionListener .because using ActionEvent object we get the component and the we get attributes and then use the get method to take the value of attribute .
<h:form>
<h:commandButton value="Submit" actionListener="#{jsf.action}">
<f:attribute name="#{jsf.name1}" value="value1" />
<f:attribute name="#{jsf.name2}" value="value2" />
</h:commandButton>
</h:form>
1)name
2)value
2-value is use to hold the value if you want to used this value then you can access using name .
3-This is work on the only actionListener .because using ActionEvent object we get the component and the we get attributes and then use the get method to take the value of attribute .
<h:form>
<h:commandButton value="Submit" actionListener="#{jsf.action}">
<f:attribute name="#{jsf.name1}" value="value1" />
<f:attribute name="#{jsf.name2}" value="value2" />
</h:commandButton>
</h:form>
3-<f:param>
2-it content following attribute
1-name
2-value
3-and it's work on the action and actionListener
<h:commandLink value="Submit" actionListener="#{jsf.action}">
<f:param name="#{jsf.name1}" value="value1" />
<f:param name="#{jsf.name2}" value="value2" />
</h:commandLink>
</h:form>