Orchestra promotes the use of the "one bean per page" paradigm. This often-used pattern means that every view (page) has only one bean associated with it. All of the server-side code that is specific to a certain page is put into the bean that is associated with that page. The Orchestra ViewController makes the association between the page and the bean a bit tighter, and has some convenient features. To define a bean as a ViewController for a specific page, the @ViewController
annotation can be used. The next example shows how the KidsTable
bean that is associated with the Kids.xhtml
page is defined as being the ViewController of that Kids.xhtml
page.
@ViewController(viewIds={"Kids.xhtml"})
public class KidsTable {
...
}
Note that the viewIds
parameter is in plural form—a comma-separated list can be used to make this bean the ViewController of multiple views.