Showing posts from July, 2011

Stateless vs Stateful JSF view parameters

JSF defines the concept of view parameters, which are used to support URL parameters in GET requests (although it can be used for non-faces POST parameters as well). View parameters are defined on a Facelet with the help of the f:viewParam tag. A typical usage looks like this: <html xmlns="" xmlns:h="" xmlns:f="" > <f:metadata> <f:viewParam name="foo_id" value="#{myBean.fooId}" /> </f:metadata> <h:body> #{myBean.fooId} </h:body> </html> In this case myBean could look like this: @Named @ViewScoped public class MyBean { private Long fooId; public Long getFooId() { return fooId; } public void setFooId(Long fooId) { this.fooId = fooId; } } There's nothing really fancy going on here. When a GET request like localhost:808…