[
https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40561
]
Matthias Wuttke commented on SHALE-425:
---------------------------------------
One last note and then I'll be silent -
I use this method on my controller superclass. By using the interface
BeanNameAware from Spring, I can automatically register the controller bean(s)
with the controller-view-mapper. Advantage: No need for manual mapping or
naming conventions. Disadvantages: Dependency on Spring (for getting the name
of the bean), not as elegant as the Shale way (controller needs to register
itself and is not detected "automatically").
private void registerPhaseController() {
FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = ctx.getViewRoot();
if (viewRoot != null) {
String viewId = viewRoot.getViewId();
PhaseAwareControllerPhaseListener.getInstance().registerController(viewId,
beanName);
}
}
I could implement this approach with Shale (and would be happy...) if there
wasn't the "session scope" problem. Maybe this would be a better topic for this
issue. "Multi-mapping" is not essential for me, but I thought it was a nice
idea I wanted to share with you. If you don't like it (too much confusion) just
drop it. ;-)
> ViewControllerMapper allows mapping only to one bean
> ----------------------------------------------------
>
> Key: SHALE-425
> URL: https://issues.apache.org/struts/browse/SHALE-425
> Project: Shale
> Issue Type: Improvement
> Components: View
> Affects Versions: 1.0.4
> Reporter: Matthias Wuttke
> Priority: Minor
>
> ViewControllerMapper.mapViewId(String viewId) allows only to map a view to a
> single bean. A key feature of JSF (IMHO) is the ability to have multiple
> backing beans / view controllers that contribute to a single page. An
> extension of this interface could allow other mapping strategies to associate
> multiple beans with a given page that can then receive phase change events. A
> possiblte mapping strategy would be a XmlViewControllerMapper which takes a
> XML file that associates view ids with bean names.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.