JSF 2 : How to pass parameter

The answers in this link at
http://stackoverflow.com/questions/3599948/jsf2-action-parameter describes techniques to pass parameter in JSF 2.

In Short, the common ways are:
1. via action method:

So in the managed bean our method would be like this:
public String action(String parameter) {}

2.via f:param :

   

In the managed bean, we can get the parameter value like this:
@ManagedProperty("#{param.foo}")
private String foo;
or this:
String foo = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("foo");

0 comments:

Post a Comment