0

In Spring you have to add attributes to the model object between view requests. Then those views use that model object to retrieve the attributes and display them. Is there an equivalent in JSF?

Kingamere
  • 9,496
  • 23
  • 71
  • 110

1 Answers1

0

https://www.google.com/search?q=JSF+beans

You should annotate your model class as @javax.faces.bean.ManagedBean. Managed (Backing) bean's parameter access happens through getters/setters.

And also @SessionScoped, @RequestScoped, etc define the scope of the bean.

Ex:

@ManagedBean
@SessionScoped
class MyProfileBean{

    private String myName;

    //getters/setters
}

myprofile.xhtml

Name: <span> #{myProfileBean.myName} </span>
sura2k
  • 7,365
  • 13
  • 61
  • 80