ViewParam vs @ManagedProperty(value = “#{param.id}”)

<f:viewParam>: Sets the value during update model values phase only (since it extends UIInput). The set value is not available during @PostConstruct, so you need an additional <f:event type=”preRenderView” listener=”#{bean.init}” /> inside the <f:metadata> to do initialization/preloading based on the set values. Since JSF 2.2 you could use <f:viewAction> for that instead. Allows for nested … Read more

What can , and be used for?

Process GET parameters The <f:viewParam> manages the setting, conversion and validation of GET parameters. It’s like the <h:inputText>, but then for GET parameters. The following example <f:metadata> <f:viewParam name=”id” value=”#{bean.id}” /> </f:metadata> does basically the following: Get the request parameter value by name id. Convert and validate it if necessary (you can use required, validator … Read more