I'm going to be migrating an application to JSF during the course of
this year and I am starting to think about some of the particular
design issues.  Any feedback would be appreciated.

The problem is that I need a list of changes from a form.  The current
way I'm doing this is to clone the "document" object that is bound to
these values in my Struts form and then compare the two objects using
some of the commons BeanUtils stuff.  This works pretty well and in
the end, I get a list of changes that I can pass through a "chain of
responsibility" pattern where each element of the chain can inspect
the list of changes for ones they are interested in.

I love the value change listener option in JSF and I think this will
be a big improvement for me.  I don't have to implement clone methods
on my document bean (and the many properties that are also document
beans).

What I'm trying to avoid is adding a listener manually through the JSF
page to every element (since I'm basically interested in all changes
so I need them all.)  I had an idea that I could have a request scope
bean that could be the listener for all changes.  That bean would
compile the master list of changes as it received that value change
events from all of the components its listening to.

Then I could have a request-level bean that would listen for the end
of the "update model values" phase.  That bean could take the list of
changes and call some business logic methods through a facade.  Since
the model would be updated at this point, I could pass references to
those beans to the facade depending on the nature of the change (ex.
change in document owner).

What do you guys think about this general approach?

sean

Reply via email to