Issue Details (XML | Word | Printable)

Key: SHALE-371
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: Stan Zapryanov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Shale

prerender() executes for ViewController not rendered when navigating to page/bean not implementing ViewController

Created: 22/Dec/06 12:01 AM   Updated: 23/Jan/07 04:40 PM
Return to search
Component/s: View
Affects Version/s: 1.0.4-SNAPSHOT
Fix Version/s: 1.0.4

Environment: Windows XP Pro, Tomcat 5.5, JDK 1.5.0_04, MyFaces

Flags: Important


 Description  « Hide
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 appears to correct the problem described but 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 }));

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

Hope all makes sense and was helpful.

Cheers!



 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Stan Zapryanov made changes - 22/Dec/06 12:22 AM
Field Original Value New Value
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!

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!

Stan Zapryanov made changes - 22/Dec/06 12:34 AM
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!

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 appears to correct the problem described but 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 }));

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

Hope all makes sense and was helpful.

Cheers!

Craig McClanahan made changes - 22/Dec/06 02:39 AM
Assignee Craig McClanahan [ craigmcc ]
Craig McClanahan made changes - 22/Dec/06 02:40 AM
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Craig McClanahan made changes - 23/Dec/06 08:58 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Rahul Akolkar made changes - 23/Jan/07 04:40 PM
Fix Version/s 1.0.4 [ 21790 ]
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Jeff Turner made changes - 09/Aug/07 07:17 AM
Workflow Struts [ 39068 ] Struts - editable closed status [ 42418 ]
Antonio Petrelli made changes - 08/Jan/09 08:57 AM
Workflow Struts - editable closed status [ 42418 ] Struts - editable closed status (temporary) [ 46311 ]
Antonio Petrelli made changes - 08/Jan/09 09:08 AM
Workflow Struts - editable closed status (temporary) [ 46311 ] Struts - editable closed status [ 52944 ]