cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Wizard Finish

venkatvj
Champ in-the-making
Champ in-the-making
Hi All,

I am facing a strange problem. I have developed a custom wizard extending BaseContentWizard. My wizard has only one step. It has a simple form that captures some information; in the Finish button handler (finishImpl method) i save the user input as an xml file in the user's sandbox.

The wizard is fired by a simple dashlet. When a user logs in he is presented with the dashlet and there is a link generated to fire the wizard. When the user clicks on the link he is shown the form (1st and only step of the wizard). The user inputs some data and hits Finish. The data is saved and the user is taken back to the dashlet screen.

Its fine until now. When the user hits the link (on the dashlet) the second time, the form comes up. BUT, when the user hits the Finish button the page refreshes and comes back with the same form. No matter how many times the Finish button is clicked the page just refreshes and comes back with the same screen. From the logs i could see the finishImpl is not called…

I am unsure what is going wrong here. I am thinking it might have to do with the outcome. But not very clear on how it works. Can someone throw some light here?

Thanks
Venk
4 REPLIES 4

gavinc
Champ in-the-making
Champ in-the-making
Can you turn on debugging for the AlfrescoNavigationHandler and post the output for the whole interaction you describe.

You can just uncomment the following line in log4j.properties:

#log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug

venkatvj
Champ in-the-making
Champ in-the-making
Thanks for looking into this Gavinc. Here is the output from the NavigationHandler.

17:49:07,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{LoginBean.login}, outcome=myalfresco)
17:49:07,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/login.jsp
17:49:07,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No dispatch context found
17:49:07,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'myalfresco' to original navigation handler
17:49:07,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=wizard:XYZ_Press_Release_Create_Wizard)
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/dashboards/container.jsp
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Opening wizard 'XYZ_Press_Release_Create_Wizard'
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using dialog container: /jsp/XYZ/dialog/container.jsp
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/XYZ/wizardcontainer.jsp
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Pushed item to view stack: /jsp/dashboards/container.jsp
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Looking up wizard in global config
17:49:23,765 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found config for wizard 'XYZ_Press_Release_Create_Wizard': org.alfresco.web.config.WizardsConfigElement$WizardConfig@6c44c5 (name=XYZ_Press_Release_Create_Wizard managed-bean=XYZPressReleaseCreateWizard actions-config-id=more_actions_menu icon=/images/icons/new_rule_large.gif title=XYZ Press Release Wizard titleId=null description= descriptionId=null errorMsgId=error_run_action_wizard)
17:49:25,406 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/XYZ/wizardcontainer.jsp
17:49:25,406 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/jsp/dashboards/container.jsp]
17:49:37,796 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{WizardManager.finish}, outcome=wizard:close)
17:49:37,796 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/XYZ/wizardcontainer.jsp
17:49:37,796 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Closing wizard, going back to previous page
17:49:37,796 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Popped item from the top of the view stack: /jsp/dashboards/container.jsp
17:49:37,796 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=wizard:XYZ_Press_Release_Create_Wizard)
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/dashboards/container.jsp
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Opening wizard 'XYZ_Press_Release_Create_Wizard'
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using dialog container: /jsp/XYZ/dialog/container.jsp
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/XYZ/wizardcontainer.jsp
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Pushed item to view stack: /jsp/dashboards/container.jsp
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Looking up wizard in global config
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found config for wizard 'XYZ_Press_Release_Create_Wizard': org.alfresco.web.config.WizardsConfigElement$WizardConfig@6c44c5 (name=XYZ_Press_Release_Create_Wizard managed-bean=XYZPressReleaseCreateWizard actions-config-id=more_actions_menu icon=/images/icons/new_rule_large.gif title=XYZ Press Release Wizard titleId=null description= descriptionId=null errorMsgId=error_run_action_wizard)
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/XYZ/wizardcontainer.jsp
17:49:52,625 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/jsp/dashboards/container.jsp]
17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{WizardManager.finish}, outcome=null)
17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/XYZ/wizardcontainer.jsp
17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No dispatch context found
17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/jsp/dashboards/container.jsp]
17:50:16,906 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{WizardManager.finish}, outcome=null)
17:50:16,906 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/XYZ/wizardcontainer.jsp
17:50:16,906 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No dispatch context found
17:50:16,906 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
17:50:16,906 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/jsp/dashboards/container.jsp]

gavinc
Champ in-the-making
Champ in-the-making
The key is the following line in the debug output:

17:50:11,156 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=#{WizardManager.finish}, outcome=null)

This shows that for some reason your wizard is returning a null outcome the 2nd time, check your logic in your finishImpl and ensure that the outcome being returned is "wizard:close".

venkatvj
Champ in-the-making
Champ in-the-making
Thanks for looking into this. Starting from your pointer….I figured out the issue. Thank you. Here is what i did:

- From the logs found that the outcome is null is logged from the finish method and not the finishImpl() method. My wizardmanager class was not overriding the finish method so i did override and set the outcome to wizard:close.

After doing the above I found that hitting the Finish button was taking me back to the dashboard screen…but…i found that the finishImpl() method was not being executed…hmm…another problem…

Looking at the source code i found that there is a field in BaseDialogBean called isFinished that is used to avoid multiple clicks on the Finish button….and only when this field is false the transaction is processed….this field is initially set to false; once the Finish button is clicked the first time this is set to true…this field is reset in the init method…

and in my custom-wizard's overriding init() method i was not calling the super.init()  and so this field isFinished was not getting reset and that was causing all the issue…

so its important to call the super.init() from the overridden init() method or reset this field in the overriding init() method…

Thanks again gavinc for your suggestions….

Venk