You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shale.apache.org by "Stan Zapryanov (JIRA)" <ji...@apache.org> on 2006/12/22 01:22:57 UTC

[jira] Updated: (SHALE-371) prerender() executes for ViewController not rendered when navigating to page/bean not implementing ViewController

     [ http://issues.apache.org/struts/browse/SHALE-371?page=all ]

Stan Zapryanov updated SHALE-371:
---------------------------------

    Description: 
Not sure if this is a bug but it looks like it. 

When navigating to a view (JSF) not implementing the ViewHandler framework from a ViewController t(JSF/bean) that does, currently the prerender() method gets executed on the viewcontroller that you are leaving (that won't get rendered). 

My guess is that currently the old FacesConstants.VIEW_NAME_RENDERED entry remains in the request map even though you are not rendering that viewconroller, and that triggers the execution of prerender(). 

Here is a suggested fix (that I have NOT tested) and I woudn't know if it may brake other stuff..

In the setupViewController() method of the ViewViewHandler class:


            vc = vr.resolveVariable(context, viewName);
            if (vc == null) {
                if (log.isDebugEnabled()) {
                    log.debug(messages.getMessage("view.noViewController",
                                                  new Object[] { viewId, viewName }));

                }
// ----PROPOSED FIX  (not tested) ----
context.getExternalContext().getRequestMap() .remove(FacesConstants.VIEW_NAME_RENDERED); 
//------END OF FIX-------
                return;
            }

Hope all makes sense and was helpful. 

Cheers!



  was:
Not sure if this is a bug but it looks like it. 

When navigating to a view (JSF) not implementing the ViewHandler framework from a ViewController t(JSF/bean) that does, currently the prerender() method gets executed on the viewcontroller that you are leaving (that won't get rendered). 

My guess is that currently the old FacesConstants.VIEW_NAME_RENDERED entry remains in the request map even though you are not rendering that viewconroller, and that triggers the execution of prerender(). 

Here is a suggested fix (that I have NOT tested) and I woudn't know if it may brake other stuff..

In the setupViewController() method of the ViewViewHandler class:


            vc = vr.resolveVariable(context, viewName);
            if (vc == null) {
                if (log.isDebugEnabled()) {
                    log.debug(messages.getMessage("view.noViewController",
                                                  new Object[] { viewId, viewName }));
// ----PROPOSED FIX  (not tested) ----
context.getExternalContext().getRequestMap() .remove(FacesConstants.VIEW_NAME_RENDERED); 
//------END OF FIX-------
                }
                return;
            }

Hope all makes sense and was helpful. 

Cheers!




> prerender() executes for ViewController not rendered when navigating to page/bean not implementing ViewController
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: SHALE-371
>                 URL: http://issues.apache.org/struts/browse/SHALE-371
>             Project: Shale
>          Issue Type: Bug
>          Components: View
>    Affects Versions: 1.0.4-SNAPSHOT
>         Environment: Windows XP Pro, Tomcat 5.5, JDK 1.5.0_04, MyFaces
>            Reporter: Stan Zapryanov
>
> Not sure if this is a bug but it looks like it. 
> When navigating to a view (JSF) not implementing the ViewHandler framework from a ViewController t(JSF/bean) that does, currently the prerender() method gets executed on the viewcontroller that you are leaving (that won't get rendered). 
> My guess is that currently the old FacesConstants.VIEW_NAME_RENDERED entry remains in the request map even though you are not rendering that viewconroller, and that triggers the execution of prerender(). 
> Here is a suggested fix (that I have NOT tested) and I woudn't know if it may brake other stuff..
> In the setupViewController() method of the ViewViewHandler class:
>             vc = vr.resolveVariable(context, viewName);
>             if (vc == null) {
>                 if (log.isDebugEnabled()) {
>                     log.debug(messages.getMessage("view.noViewController",
>                                                   new Object[] { viewId, viewName }));
>                 }
> // ----PROPOSED FIX  (not tested) ----
> context.getExternalContext().getRequestMap() .remove(FacesConstants.VIEW_NAME_RENDERED); 
> //------END OF FIX-------
>                 return;
>             }
> Hope all makes sense and was helpful. 
> Cheers!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira