users@glassfish.java.net

RE: JSF Passing data from page to page

From: Jason Lee <lee_at_iecokc.com>
Date: Thu, 1 Mar 2007 08:39:31 -0600

> -----Original Message-----
> Since there is no specific JSF forum I am posting my question here.
> As I am used to php programming for web sites I'm having
> problems to fit my thoughts in the JSF programming model.

FWIW, Developer Forums - Web Tier APIs - JavaServer Faces :
http://forum.java.sun.com/forum.jspa?forumID=427

> info and user preferences). Is there a better solution?
> Managed properties can't be used in multi-to-one view
> navigation since the previous view has a different backing bean...

A Faces-managed bean (often called a backing bean) can be used on as
many pages as you would like. There's no technical reason you can't.
In fact, most of my (smaller) apps share one or two beans across all the
pages.

If you're using 1.2 (which would mean, at the moment, RI/Sun's impl),
you can also do per page view PhaseListeners allowing you to pass a
query string to the page, pull the information from the query string in
the PL and apply it to the managed bean, and do all that with
request-scoped beans if you like that better.

> A second problem is a custom table generated by code, since
> users should be able to define column order and visibility I
> am creating that table in the code. That works fine but takes
> a lot of controller code in each table's backing bean
> (paging, sorting, filtering and col order), is there another
> way to solve this problem?

Component binding can lead to a lot of code, but you could probably
factor that code out into a reusable (and possibly static) method, so
that the code is not duplicated and is not unnecessarily bloating your
managed bean.

-----
Jason Lee, SCJP
JSF RI Dev Team
Senior Software Engineer
http://www.iec-okc.com