Issue Details (XML | Word | Printable)

Key: SHALE-307
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: Jonathan Baker
Votes: 0
Watchers: 0
Operations

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

ViewController for navigated-to page is not added to the request map until bean is referenced in RenderResponse phase.

Created: 12/Oct/06 05:31 PM   Updated: 23/Jan/07 04:40 PM
Return to search
Component/s: View
Affects Version/s: 1.0.3
Fix Version/s: 1.0.4

Environment:
linux
tomcat5.5.19
java 1.5.02


 Description  « Hide
I currently have a page with a list of items on it. For each line, there is a link to select one of the items. When an item is selected, the action method bound to that link fetches the item from a database and retruns an outcome that has a navigation rule to navigate to a item detail page. Based on some values in that item, we would like to display a message to the user. I initally added those methods in the prerender method of the view controller of the item detail page. It looks though that prerender in the case described above is not being called on the view controller of the detail page because at the time of beforeRenderResponse phase the ViewController for the new page has not been added to the request scope map.

The ViewController doesn't actually get added to the request map until the first reference to it is found when parsing the jsp page components which occurs sometime during the RenderResponse jsf phase.

The prerender plug point is essentially useless. It will get called anytime I take an action that stays on the current page, but when navigating from one page to another, it will never get called.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #465311 Wed Oct 18 17:40:30 UTC 2006 craigmcc Add an integration test case to investigate SHALE-307, which reports
that prerender() is not getting called on the second page when
navigating from one view controller to another. At the moment, the test
case passes (indicating prerender() was indeed called as expected), so
further investigation is necessary to see where a failure case might
still exist.

SHALE-307
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/core/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/menu.jsp
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/WEB-INF/faces-config.xml
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle2.java
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle1.java
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp

Repository Revision Date User Message
ASF #465318 Wed Oct 18 17:58:58 UTC 2006 craigmcc Add a test case for lifecycle navigation events similar to the one just added
to shale-test-view, but this time using annotated view controllers to test
the corresponding Tiger functionality.

SHALE-307
Files Changed
ADD /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Recorder.java (from /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Recorder.java)
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/menu.jsp
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/test/java/org/apache/shale/examples/test/tiger/systest/IntegrationTestCase.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/WEB-INF/faces-config.xml
ADD /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Lifecycle2.java (from /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle2.java)
ADD /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/java/org/apache/shale/examples/test/tiger/Lifecycle1.java (from /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle1.java)
ADD /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/lifecycle1.jsp (from /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle1.jsp)
ADD /shale/framework/trunk/shale-apps/shale-test-tiger/src/main/webapp/lifecycle2.jsp (from /shale/framework/trunk/shale-apps/shale-test-view/src/main/webapp/lifecycle2.jsp)

Craig McClanahan made changes - 18/Oct/06 06:07 PM
Field Original Value New Value
Assignee Craig McClanahan [ craigmcc ]
Craig McClanahan added a comment - 18/Oct/06 06:11 PM
Jonathan, could you please try your test case against a recent nightly build[1]? The reason I ask is that this issue has been addressed in the current code (so it'll be fixed in 1.0.4), and I have added some test cases to verify that it does indeed work. (The reason it now works, by the way, is that Shale's custom ViewHandler ensures the view controller managed bean, if there is one, is instantiated and placed in request scope whenever an old view is restored or a new view is created, so it will be in scope already when prerender is called.)

NOTE -- in the nightly build code, the view controller stuff has been factored out of shale-core-xxxxx.jar, so you'll need to add shale-view-xxxxx.jar to your webapp as well as replacing the othe Shale jars.

[1] http://shale.apache.org/index.html#download

Craig McClanahan made changes - 18/Oct/06 06:15 PM
Component/s View [ 21300 ]
Component/s Core [ 21250 ]
Repository Revision Date User Message
ASF #465959 Fri Oct 20 03:08:03 UTC 2006 craigmcc Correct the package name for the integration tests, and add a bit more
debugging output so that destroy events can be manually verified.

SHALE-307
Files Changed
DEL /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/core
ADD /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view (from /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/core)
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle2.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/main/java/org/apache/shale/examples/test/view/Lifecycle1.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-view/src/test/java/org/apache/shale/examples/test/view/systest/IntegrationTestCase.java

Craig McClanahan added a comment - 20/Oct/06 03:08 AM
As far as I can tell, all issues with ViewController events for navigated-to pages are operating correctly (nightly build 20061020, and will be included in 1.0.4), so I'm marking this issue as fixed. Please reopen if you still have problems with the current code.

Craig McClanahan made changes - 20/Oct/06 03:08 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Jonathan Baker added a comment - 27/Oct/06 08:42 PM
I attempted this with a build from 10/18 and my problem is still happening.

In my action method I return "display_item"

I have a navigation rule like this:

    <navigation-rule>
        <navigation-case>
            <from-outcome>display_item</from-outcome>
            <to-view-id>/selectionItem.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

I have a spring bean defined in my application context file:

<bean id="selectionItem" class="...SelectionItemViewController" scope="request">

(using spring 2.0-final)

When the before render response phase is triggered, my view controller is still not in the request map, so prerender is not called on my view controller. Later, when the first reference to my view controller is parsed in the jsp page, the view controller is loaded.

Jonathan Baker added a comment - 09/Nov/06 01:02 AM

   [[ Old comment, sent from unregistered email on Wed, 18 Oct 2006 15:29:18 -0400 ]]

Sure, thank you very much. I will let you know if it resolves my issue.



JB


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 [ 38820 ] Struts - editable closed status [ 42424 ]
Antonio Petrelli made changes - 08/Jan/09 08:57 AM
Workflow Struts - editable closed status [ 42424 ] Struts - editable closed status (temporary) [ 46300 ]
Antonio Petrelli made changes - 08/Jan/09 09:08 AM
Workflow Struts - editable closed status (temporary) [ 46300 ] Struts - editable closed status [ 52983 ]