Splitting up pages in a Seam application


April 2019


0 time


I'm quite new to Seam and am working on a relatively large project at work. The application is quite complicated in that there's a lot going on a single page at any time. I'm trying to figure out how to structure this and would like some feedback.

A good example to base this on would be Facebook (or a similar social media app). Facebook has a ton of stuff going on the screen. If all that logic were in a single view and backing bean, the files would be monolithic in size.

The way I see it is you'd have different components. For example, in Facebook, there'd be a component that handles showing your friends or friends in common with another person, there'd be another component handling invitations, suggestions, etc, etc.

All this is separate functionality being displayed on a single page however, in some cases, although being separate components, they're related at the end of the end. For example, if I click something in the main screen (i.e. not the elements in the sidebars) that generates an ajax request, a component in the sidebar might need to be updated automatically or rerendered.

Further than just sidebar components, there might be multiple disparate elements in the main area of a page (for example, a tabbed area where each panel could, in actuality be a separate or a separate view of the page).

It would be ugly if I had to handle everything in a single backing bean or something similar. It makes sense to me that each of these disparate elements have their own controllers (backing beans?) and what not. If I do an action in component x, it's bean could fire an event that could be listened to from component y's bean (thus causing component y to be rerendered).

Any ideas or resources I could look at?

1 answers


Seam certainly allows division of pages into multiple fragments with separate backing components. They can be quite independent but can also interact.

To learn it, start with the Seam tutorial at JBoss and the book Seam in Action.

For the Ajax interaction you're looking for, you might also want to look at the RichFaces Developer Guide.