You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shale.apache.org by "Matthias Wuttke (JIRA)" <ji...@apache.org> on 2007/03/14 13:41:51 UTC

[jira] Created: (SHALE-425) ViewControllerMapper allows mapping only to one bean

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.


SV: [jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by Hermod Opstvedt <he...@opstvedt.com>.
Hi

I think maybe there is a misunderstanding of idea behind the ViewController.
It is exactly for mapping one Controller! against a view - Hence the name
ViewController.

Just out of curiosity: Why would you want multiple viewcontrollers against a
view?

I think you may have misunderstood something. You can use multiple beans! To
feed a view with data.

Hermod


-----Opprinnelig melding-----
Fra: Matthias Wuttke (JIRA) [mailto:jira@apache.org] 
Sendt: 14. mars 2007 13:47
Til: issues@shale.apache.org
Emne: [jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only
to one bean


    [
https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.pl
ugin.system.issuetabpanels:comment-tabpanel#action_40550 ] 

Matthias Wuttke commented on SHALE-425:
---------------------------------------

Another (IMHO good) mapping strategy would be to allow backing beans to
programmatically register themselves with the view mapper:

MyCoolDynamicViewMapper.registerBean(ctx.getViewRoot().getViewId(),
"myBeanName");

This allows the use of abstract super classes for backing beans and allows
for backing beans that are responsible for different views.

> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Craig McClanahan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40557 ] 

Craig McClanahan commented on SHALE-425:
----------------------------------------

> 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.

Interesting idea.  From my viewpoint, the view controller mapping is primarily a mechanism to use "convention over configuration" to identify a managed bean that should receive application related events that are associated with a view.  In no way are you limited to binding *only* to this particular bean in our view -- you can use value binding expressions to bind to data from lots of different beans.  Given this, I am a believer in the philosophy that all the event handlers for a particular view should be together in the same managed bean, which minimizes the number of different places a developer has to look at.

If there were more than one output of view controller mapping, on which bean should events like init(), preprocess(), prerender(), and destroy() be called?  All of them?  Only those that implement ViewController?  Only the first one?  All I can see coming out of this is confusion.  Can you help me understand what kinds of benefits you are looking for by having this?

Note that you can already use abstract superclasses to provide shared handling methods for commonly implemented actions.  Indeed, we offer a convenience abstract base class (AbstractViewController) which you can extend, and leverage shared functionality.  A common strategy is to build your own convenience base classes that add shared application specific actions (and helper methods), and then have your actual view controller beans extend that.


> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Matthias Wuttke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40601 ] 

Matthias Wuttke commented on SHALE-425:
---------------------------------------

Don't know if this can be helpful:

package teuto.base.shale;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

import org.apache.shale.view.Constants;
import org.apache.shale.view.ViewControllerMapper;
import org.apache.shale.view.impl.DefaultViewControllerMapper;

/**
 * ViewControllerMapper that allows for dynamic
 * registration of mappings at runtime or application startup.
 * Provides convenience methods for registering a mapping
 * for the currently executing controller bean and
 * the view currently rendered.
 * @author Matthias Wuttke
 */
public class MemoryViewControllerMapper
extends DefaultViewControllerMapper {

	/**
	 * Returns the name of the controller bean to
	 * be used with the passed view id. Falls back
	 * to the default Shale implementation if there
	 * is no dynamically registered view controller.
	 * @param viewId view id
	 * @return controller name
	 */
	public String mapViewId(String viewId) {
		String beanName = mapping.get(viewId);
		if (beanName != null)
			return beanName;
		
		return super.mapViewId(viewId);
	}
	
	/**
	 * Registers a mapping for the given view id and
	 * bean name.
	 * @param viewId id of the view
	 * @param beanName name of the controller bean
	 */
	public void registerMapping(String viewId, String beanName) {
		if (!mapping.containsKey(viewId))
			mapping.put(viewId, beanName);
	}
	
	/**
	 * Registers the given bean for the view that is
	 * currently being rendered. 
	 * @param beanName name of the controller bean
	 */
	public void registerMapping(String beanName) {
		FacesContext ctx = FacesContext.getCurrentInstance();
		UIViewRoot viewRoot = ctx.getViewRoot();
		if (viewRoot != null) {
			String viewId = viewRoot.getViewId();
			registerMapping(viewId, beanName);
		}	
	}
	
	/**
	 * Convenience method for registering multiple
	 * mappings at once. This can be used to initialize
	 * this class from a properties file.
	 * @param mappings
	 */
	public void setMappings(Properties mappings) {
		for (Object key : mappings.keySet())
			mapping.put((String)key, mappings.getProperty((String)key));
	}
		
	/**
	 * Convenience method for retrieving the instance of
	 * this object from the Faces application context.
	 * @return instance or null
	 */
	public static MemoryViewControllerMapper getInstance() {
		FacesContext ctx = FacesContext.getCurrentInstance();
		if (ctx != null) {
			ViewControllerMapper vcm = (ViewControllerMapper) 
				ctx.getExternalContext().getApplicationMap().get(Constants.VIEW_MAPPER);
			if (vcm instanceof MemoryViewControllerMapper)
				return (MemoryViewControllerMapper)vcm;
		}
		
		return null;
	}
	
	private Map<String, String> mapping =
		new HashMap<String, String>();

}


> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Craig McClanahan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40570 ] 

Craig McClanahan commented on SHALE-425:
----------------------------------------

> Thank you very much for your responses. First: Should I have posted my
> suggestion to a mailing list or is it ok to discuss such things here?

Either way works for me -- since you were making a specific enhancement suggestion, logging it as an issue first ties all related information together.  The downside is that nobody on the user list will generally see it, and be able to comment on their own thoughts, unless they happen to be browsing the issue tracking system.

> I think it is not confusing to have multiple view controllers, each of them
>  with separate responsibilities. Imagine a "treeController" that is able to
> handle a navigation tree (load data for the tree component, respond to
> events, etc.) and a "detailController" that deals with the form displayed
> besides the navigation (saving form data using Hibernate, etc.). Both of
> them might need prerender() methods, for example to load data for list
> items after the other form fields have been validated and applied to the
> model and before the page gets rendered. Both of them seem to have
> "equal rights" for being the "main" controller. Of course I could just create
> a single main backing controller bean that just returns these two beans,
> but it did not seem to be a big deal for me to allow multiple controllers being
> mapped per page.

This sounds like a great place to use subviews.  Each subview can itself associated with its own view controller bean, and therefore have its own event handlers.  See the <s:subview> TLDdocs for more info.  The content inside <s:subview> can be normal JSP content, or you can use something like <jsp:include> to reuse a shared fragment in a separate file.

> This is especially because I personally do not like the to default naming
> the Shale View imposes on me for my controllers (being a big fan of
> "convention over configuration, though): I think "admin$compactDisc_list"
> is far too long for a bean name, and I think template names should be
> allowed to contain a "-" like in "admin/compactDisc-list.xhtml".

You are free to change the algorithm if you want.  Define your own class that implements ViewControllerMapper, and then configure it by specifying the fully qualified class name as the value of a context init parameter named "org.apache.shale.view.VIEW_CONTROLLER_MAPPER" in your web.xml file.

> By the way, I'm using MyFaces, Facelets, Shale and Spring together
> and I noticed some issues with Shale Tiger and Spring:

Since these are really separate issues, they should really be filed separately :-).

> - Shale only supports "request"-scoped beans for ViewControllers. My
> listController is in session-scope because I want settings like sort order,
> list cursor and filter settings to be persistent across multiple invocations
> (especially useful for a list-detail scenario where the user is returned to
> the right page of list data after completing the detail form).

Supporting only request scope view controllers is a deliberate design decision.  You are mixing controller and view information in your scenario above ... I would handle that by storing the cursor and filter settings in a separate data-only bean in session scope, and referencing it from your request scoped controller.

> - I cannot override defaults in the faces-config.xml contained in shale-view.jar
> with Spring. This is because the Spring VariableResolver first asks the underlying
> (Shale/JSF) resolver. I'm afraid I cannot write

    <!-- Shale View-Controller-Mapping -->
    <bean name="org$apache$shale$view$VIEW_MAPPER"
        class="teuto.base.shale.MemoryViewControllerMapper">
        <property name="mappings">
            <props>
                <prop key="/admin/compactDisc-list.xhtml">compactDiscListController</prop>
            </props>
        </property>
    </bean>

but I need to declare the following in my faces-config.xml

    <managed-bean>
        <managed-bean-name>org$apache$shale$view$VIEW_MAPPER</managed-bean-name>
        <managed-bean-class>teuto.base.shale.MemoryViewControllerMapper</managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>
   
> The same goes for "org$apache$shale$view$VIEW_CALLBACKS" (which I need
> to set to org.apache.shale.tiger.view.faces.ViewControllerCallbacks2 in order
> to make Shale Tiger work, which should not be necessary, but might also be
> because of a Spring problem - don't know).

There are a couple of related problems here.

* JSF provides no mechanism for controlling the order in which
  the variable resolver chain (or any other configurable plugin chain)
  gets initialized.  Therefore, there's no way to insist that the
  Spring variable resolver chain gets invoked first.

* You can configure the replacement view controller mapper, if
  you want, by a context init parameter.  See above for info.

* For any Shale feature that is implemented as a default managed bean
  (such as the callbacks controller), the most reliable way to initialize
  your own version is to set up a ServletContextListener.  In the
  contextInitialized method, use Spring's bean factory (via the
  application context) to create and configure the instance you want
  to use, and then store it in application scope under the appropriate
  key (if you're using Spring 2.0 or later, you can ask Spring to do this
  latter part for you).

> These limitations made me not use Shale View (which I very much would
> like to use), but instead implement an own mechanism for delegating
> PhaseListener events to controller beans. I'm not sure whether you are
> interested, but if you like I would share the code with you. :-)

Do the above suggestions deal with your concerns?





> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Matthias Wuttke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40550 ] 

Matthias Wuttke commented on SHALE-425:
---------------------------------------

Another (IMHO good) mapping strategy would be to allow backing beans to programmatically register themselves with the view mapper:

MyCoolDynamicViewMapper.registerBean(ctx.getViewRoot().getViewId(), "myBeanName");

This allows the use of abstract super classes for backing beans and allows for backing beans that are responsible for different views.

> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Matthias Wuttke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40579 ] 

Matthias Wuttke commented on SHALE-425:
---------------------------------------

> Do the above suggestions deal with your concerns? 

Yes, they do. Thanks a lot for your help!

Matthias

> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Hermod Opstvedt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40558 ] 

Hermod Opstvedt commented on SHALE-425:
---------------------------------------

Hi

I think maybe there is a misunderstanding of idea behind the ViewController. It is exactly for mapping one Controller! against a view - Hence the name ViewController.

Just out of curiosity: Why would you want multiple viewcontrollers against a view?

I think you may have misunderstood something. You can use multiple beans! To feed a view with data.


> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Matthias Wuttke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/SHALE-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40560 ] 

Matthias Wuttke commented on SHALE-425:
---------------------------------------

Hi!

Thank you very much for your responses. First: Should I have posted my suggestion to a mailing list or is it ok to discuss such things here?

I think it is not confusing to have multiple view controllers, each of them with separate responsibilities. Imagine a "treeController" that is able to handle a navigation tree (load data for the tree component, respond to events, etc.) and a "detailController" that deals with the form displayed besides the navigation (saving form data using Hibernate, etc.). Both of them might need prerender() methods, for example to load data for list items after the other form fields have been validated and applied to the model and before the page gets rendered. Both of them seem to have "equal rights" for being the "main" controller. Of course I could just create a single main backing controller bean that just returns these two beans, but it did not seem to be a big deal for me to allow multiple controllers being mapped per page. 

This is especially because I personally do not like the to default naming the Shale View imposes on me for my controllers (being a big fan of "convention over configuration, though): I think "admin$compactDisc_list" is far too long for a bean name, and I think template names should be allowed to contain a "-" like in "admin/compactDisc-list.xhtml".

By the way, I'm using MyFaces, Facelets, Shale and Spring together and I noticed some issues with Shale Tiger and Spring:

- Shale only supports "request"-scoped beans for ViewControllers. My listController is in session-scope because I want settings like sort order, list cursor and filter settings to be persistent across multiple invocations (especially useful for a list-detail scenario where the user is returned to the right page of list data after completing the detail form).

- I cannot override defaults in the faces-config.xml contained in shale-view.jar with Spring. This is because the Spring VariableResolver first asks the underlying (Shale/JSF) resolver. I'm afraid I cannot write

    <!-- Shale View-Controller-Mapping -->
    <bean name="org$apache$shale$view$VIEW_MAPPER"
        class="teuto.base.shale.MemoryViewControllerMapper">
        <property name="mappings">
            <props>
                <prop key="/admin/compactDisc-list.xhtml">compactDiscListController</prop>
            </props>
        </property>
    </bean>

but I need to declare the following in my faces-config.xml

    <managed-bean>
        <managed-bean-name>org$apache$shale$view$VIEW_MAPPER</managed-bean-name>
        <managed-bean-class>teuto.base.shale.MemoryViewControllerMapper</managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>
   
The same goes for "org$apache$shale$view$VIEW_CALLBACKS" (which I need to set to org.apache.shale.tiger.view.faces.ViewControllerCallbacks2 in order to make Shale Tiger work, which should not be necessary, but might also be because of a Spring problem - don't know).

These limitations made me not use Shale View (which I very much would like to use), but instead implement an own mechanism for delegating PhaseListener events to controller beans. I'm not sure whether you are interested, but if you like I would share the code with you. :-)

Matthias

> 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.


[jira] Commented: (SHALE-425) ViewControllerMapper allows mapping only to one bean

Posted by "Matthias Wuttke (JIRA)" <ji...@apache.org>.
    [ 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.