Hi,

Currently the SpringViewControllerScope class has jsf-specific code in
it to retrieve the current viewId, so that it can then look up the "view
controller bean" for the current view.

This is not desirable as this means that we have:
(a) a reference from the spring-specific packages to the jsf-specific
packages, and
(b) the view-controller-scope is not usable in any environment other
than jsf.

It seems to me that the cleanest solution is to add a method to the
FrameworkAdapter astract class:
  String getCurrentViewId();

We could provide a default implementation that returns the constant
string "defaultView" or similar. This avoids breaking existing
FrameworkAdapter subclasses, and theoretically allows users of non-jsf
frameworks to have a global view-controller instance by just adding a
spring bean with that name.

The JsfFrameworkAdapter would of course return
  FacesContext.getCurrentInstance().getViewRoot().getViewId()
and the SpringViewControllerScope would then just call
  FrameworkAdapter.getInstance().getCurrentViewId().

Are there any objections to this?

Regards,
Simon

Reply via email to