Re: AW: Workflow Extention
Ok, this was not an easy one... :-) The mistake you seem to make is the following: The actions /login and /login/action basically are identical in what they are doing: They map to the LoginAction. What you are doing in LoginAction (I am guessing now) is forwarding to the input mapping, in case the parameters user and password are not included or are not valid. What you really want to do is: Use the action /login as a simple display action (which does not do any checks at all, but just forward to the right jsp page) like this: action path=/login type=com.livinglogic.struts.workflow.SuccessAction set-property property=primaryWorkflow value=login-workflow / set-property property=newState value=1 / forward name=success path=/tiles/login / /action The problem with your approach is the following: Whenever an action is forwarding to mapping.getInput() the workflow's state is not updated, because the action has not really been completed successfully. If the state had been updated, an error would occur, when the user submits the form again. --- Matthias Jordan Thomas wrote: OK, Here it is. The original workflow is now working but this work flow is not. Included is a snippet form my log file. Also here is the struts config snippet. action path=/login type=scoop.web.struts.login.LoginAction className=com.livinglogic.struts.workflow.ApplicationMapping name=loginForm scope=request input=/tiles/login validate=true set-property property=primaryWorkflow value=login-workflow/ set-property property=newState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/login/ /action action path=/login/action type=scoop.web.struts.login.LoginAction className=com.livinglogic.struts.workflow.ApplicationMapping name=loginForm scope=request input=/login/action validate=true set-property property=primaryWorkflow value=login-workflow/ set-property property=newState value=2/ set-property property=prevState value=1/ set-property property=endWorkflow value=true/ forward name=success path=loggedinhome/ /action thanks again Jordan -Original Message- From: Matthias Bauer [mailto:[EMAIL PROTECTED]] Sent: Thursday, 5 December 2002 3:30 PM To: Jordan Thomas Cc: Struts User List Subject: Re: AW: Workflow Extention Jordan, the configuration looks ok to me. Can you please send me the complete log messages. They should look somehow like these (I took them from the example application): 2002-12-05 15:27:52 action: Processing a GET for /beginWf1Transition 2002-12-05 15:27:52 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:27:52 action: Authtype: com.livinglogic.struts.workflow.test.Authentication 2002-12-05 15:27:52 action: Previous primary workflow: null 2002-12-05 15:27:52 action: Current primary workflow: wf1 2002-12-05 15:27:52 action: Updating workflow: wf1 2002-12-05 15:27:52 action: Setting currentState to 1 2002-12-05 15:27:52 action: Setting definedNextStates to [2] 2002-12-05 15:27:52 action: Setting definedNextPaths to [] 2002-12-05 15:27:52 action: Forward to: /inHome.jspp 2002-12-05 15:28:03 action: Processing a GET for /wf1St2Transition 2002-12-05 15:28:03 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:28:03 action: Authtype: com.livinglogic.struts.workflow.test.Authentication 2002-12-05 15:28:03 action: Defined workflow: wf1 2002-12-05 15:28:03 action: Cleanup action names: [cleanupWf1] 2002-12-05 15:28:03 action: Current state: 1 2002-12-05 15:28:03 action: Defined next states: [2] 2002-12-05 15:28:03 action: Defined next paths: [] 2002-12-05 15:28:03 action: Previous primary workflow: wf1 2002-12-05 15:28:03 action: Current primary workflow: wf1 2002-12-05 15:28:03 action: Updating workflow: wf1 2002-12-05 15:28:03 action: Setting currentState to 2 2002-12-05 15:28:03 action: Setting definedNextStates to [3, 2] 2002-12-05 15:28:03 action: Setting definedNextPaths to [] 2002-12-05 15:28:03 action: Forward to: /inHome.jspp --- Matthias Jordan Thomas wrote: Hi Matthias OK, I have modified my workflow as I have seen the obvious errors in what I was trying to do. Now I have the problem that my second action (see code below) does not allow me to enter that step. The message that I am getting is Previous state does not match any allowed previous state!. From what I can see, the previousState of the second step does match the newState of the first step. One thing that I have noticed is that when I enter the first state it says Current State: null. Any ideas? thanks Jordan action path=/registration/1 type=scoop.web.struts.registration.RegistrationAction className
RE: AW: Workflow Extention
Hi Matthias OK, I have modified my workflow as I have seen the obvious errors in what I was trying to do. Now I have the problem that my second action (see code below) does not allow me to enter that step. The message that I am getting is Previous state does not match any allowed previous state!. From what I can see, the previousState of the second step does match the newState of the first step. One thing that I have noticed is that when I enter the first state it says Current State: null. Any ideas? thanks Jordan action path=/registration/1 type=scoop.web.struts.registration.RegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=request input=/tiles/registerCompany validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany/ /action action path=/registration/2 type=scoop.web.struts.registration.RegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=session input=/tiles/registerCompany_step1 validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=2/ set-property property=prevState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany/ /action -Original Message- From: Matthias Bauer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 November 2002 3:08 PM To: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Subject: Re: AW: Workflow Extention Jordan, I think I understand pretty well, what you are trying to do. However according to your configuration you should not be able to execute /registration/2 before having executed /registration/1. Here are some examples: /registration - /registration/1 - /registration/1-/registration/2 - this should work /registration - /registration/1 - /registration/3 - this should fail with the last action /registration - /registration/1 - /registration/2-/registration/1 - this should fail with the last action /registration - /registration/1 - /someAction-/registration/2 - this should work, if /someAction is not part of the workflow Maybe you can try these examples out and see if it works as expected. Remark to the last example: The last example works, if /someAction is not part of the registration-workflow, because it does not change the state of this workflow. --- Matthias Jordan Thomas wrote: Yes, I see what you are saying and if I define the next state, then if I try to jump out of the workflow I get a an exception saying that it is not allowed by the workflow. What makes me think that it is disregarding the wrokflow is that I can enter the workflow at an point (i.e /registration/2) without having executed any of the other steps. Essentially, all I want to do is not control where the user goes but where the user came from. This way, it cascades backwards ensuring that the user enters in all of the data. Is this clearer? Hopefully you have an idea on how to solve this one. Cheers and thanks for the help Jordan -Ursprüngliche Nachricht- Von: Matthias Bauer [mailto:[EMAIL PROTECTED]] Gesendet: Wednesday, 27 November 2002 1:22 PM An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: Workflow Extention Jordan, according to the configuration the user should not be able to execute /registration/1 before having executed /registration. Also /registration/2 can not be executed before /registration/1, and so on. What the configuration does NOT prohibit, is to execute /registration or any other action after /registration/1 or /registration/2, because you are not defining nextState values. Do you see something else? What lets you think that it seems to be disregarding the workflow? One remark: You can as well leave away the property endWorkflow if you want it to be false, because this is the default. --- Matthias Jordan Thomas wrote: Matthias, Ok, I tried that and it now seems to be disregarding the workflow. Can you seen anything wrong with my struts-config.xml tags? (Sorry for the big code chunk :O) Essentially what (am trying to do is allow a user to go to the next step or stay on the same step. I am using struts 1.1b Thanks Jordan --action class ... public final class NewRegistrationAction extends GenericAction { public ActionForward performAction( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { ... --struts-config.xml action path=/registration
Re: AW: Workflow Extention
Jordan, the configuration looks ok to me. Can you please send me the complete log messages. They should look somehow like these (I took them from the example application): 2002-12-05 15:27:52 action: Processing a GET for /beginWf1Transition 2002-12-05 15:27:52 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:27:52 action: Authtype: com.livinglogic.struts.workflow.test.Authentication 2002-12-05 15:27:52 action: Previous primary workflow: null 2002-12-05 15:27:52 action: Current primary workflow: wf1 2002-12-05 15:27:52 action: Updating workflow: wf1 2002-12-05 15:27:52 action: Setting currentState to 1 2002-12-05 15:27:52 action: Setting definedNextStates to [2] 2002-12-05 15:27:52 action: Setting definedNextPaths to [] 2002-12-05 15:27:52 action: Forward to: /inHome.jspp 2002-12-05 15:28:03 action: Processing a GET for /wf1St2Transition 2002-12-05 15:28:03 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:28:03 action: Authtype: com.livinglogic.struts.workflow.test.Authentication 2002-12-05 15:28:03 action: Defined workflow: wf1 2002-12-05 15:28:03 action: Cleanup action names: [cleanupWf1] 2002-12-05 15:28:03 action: Current state: 1 2002-12-05 15:28:03 action: Defined next states: [2] 2002-12-05 15:28:03 action: Defined next paths: [] 2002-12-05 15:28:03 action: Previous primary workflow: wf1 2002-12-05 15:28:03 action: Current primary workflow: wf1 2002-12-05 15:28:03 action: Updating workflow: wf1 2002-12-05 15:28:03 action: Setting currentState to 2 2002-12-05 15:28:03 action: Setting definedNextStates to [3, 2] 2002-12-05 15:28:03 action: Setting definedNextPaths to [] 2002-12-05 15:28:03 action: Forward to: /inHome.jspp --- Matthias Jordan Thomas wrote: Hi Matthias OK, I have modified my workflow as I have seen the obvious errors in what I was trying to do. Now I have the problem that my second action (see code below) does not allow me to enter that step. The message that I am getting is Previous state does not match any allowed previous state!. From what I can see, the previousState of the second step does match the newState of the first step. One thing that I have noticed is that when I enter the first state it says Current State: null. Any ideas? thanks Jordan action path=/registration/1 type=scoop.web.struts.registration.RegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=request input=/tiles/registerCompany validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany/ /action action path=/registration/2 type=scoop.web.struts.registration.RegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=session input=/tiles/registerCompany_step1 validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=2/ set-property property=prevState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany/ /action -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: AW: Workflow Extention
Matthias, In addition here is the console output. cheers Jordan 16:59:39,370 INFO [RequestProcessor] Processing a 'GET' for path '/login' 16:59:39,410 INFO [Engine] action: Authtype: null 16:59:39,410 INFO [Engine] action: Defined workflow: registration-workflow 16:59:39,420 INFO [Engine] action: Current state: 1 16:59:39,430 INFO [Engine] action: Defined next states: [] 16:59:39,430 INFO [Engine] action: Defined next paths: [] 16:59:39,440 INFO [Engine] action: Previous primary workflow: registration-workflow 16:59:39,470 INFO [Engine] action: Current primary workflow: login-workflow 16:59:39,470 INFO [Engine] action: Forward to: /tiles/login 16:59:44,387 INFO [Engine] jsp: init 16:59:52,870 INFO [Engine] jsp: init 16:59:57,136 INFO [Engine] jsp: init 17:00:03,805 INFO [RequestProcessor] Processing a 'GET' for path '/registration' 17:00:03,815 INFO [Engine] action: Authtype: null 17:00:03,825 INFO [Engine] action: Defined workflow: registration-workflow 17:00:03,825 INFO [Engine] action: Current state: 1 17:00:03,835 INFO [Engine] action: Defined next states: [] 17:00:03,845 INFO [Engine] action: Defined next paths: [] 17:00:03,845 INFO [Engine] action: Defined workflow: login-workflow 17:00:03,855 INFO [Engine] action: Current state: null 17:00:03,865 INFO [Engine] action: Defined next states: null 17:00:03,865 INFO [Engine] action: Defined next paths: null 17:00:03,875 INFO [Engine] action: Previous primary workflow: registration-workflow 17:00:03,885 INFO [Engine] action: Current primary workflow: registration-workflow 17:00:03,906 INFO [Engine] action: Updating workflow: registration-workflow 17:00:03,906 INFO [Engine] action: Setting currentState to 1 17:00:03,916 INFO [Engine] action: Setting definedNextStates to [] 17:00:03,926 INFO [Engine] action: Setting definedNextPaths to [] 17:00:03,936 INFO [Engine] action: Forward to: /tiles/registration 17:00:06,619 INFO [RequestProcessor] Processing a 'GET' for path '/login' 17:00:06,629 INFO [Engine] action: Authtype: null 17:00:06,639 INFO [Engine] action: Defined workflow: registration-workflow 17:00:06,649 INFO [Engine] action: Current state: 1 17:00:06,659 INFO [Engine] action: Defined next states: [] 17:00:06,659 INFO [Engine] action: Defined next paths: [] 17:00:06,669 INFO [Engine] action: Defined workflow: login-workflow 17:00:06,680 INFO [Engine] action: Current state: null 17:00:06,680 INFO [Engine] action: Defined next states: null 17:00:06,690 INFO [Engine] action: Defined next paths: null 17:00:06,700 INFO [Engine] action: Previous primary workflow: registration-workflow 17:00:06,700 INFO [Engine] action: Current primary workflow: login-workflow 17:00:06,710 INFO [Engine] action: Forward to: /tiles/login 17:00:08,212 INFO [RequestProcessor] Processing a 'POST' for path '/login/action' 17:00:08,222 INFO [Engine] action: Authtype: null 17:00:08,232 INFO [Engine] action: Defined workflow: registration-workflow 17:00:08,232 INFO [Engine] action: Current state: 1 17:00:08,242 INFO [Engine] action: Defined next states: [] 17:00:08,242 INFO [Engine] action: Defined next paths: [] 17:00:08,252 INFO [Engine] action: Defined workflow: login-workflow 17:00:08,262 INFO [Engine] action: Current state: null 17:00:08,272 INFO [Engine] action: Defined next states: null 17:00:08,272 INFO [Engine] action: Defined next paths: null 17:00:08,282 INFO [Engine] action: Previous primary workflow: registration-workflow 17:00:08,292 INFO [Engine] action: Current primary workflow: login-workflow 17:00:08,292 INFO [Engine] action: Previous state does not match any allowed previous state! -Original Message- From: Matthias Bauer [mailto:[EMAIL PROTECTED]] Sent: Thursday, 5 December 2002 3:30 PM To: Jordan Thomas Cc: Struts User List Subject: Re: AW: Workflow Extention Jordan, the configuration looks ok to me. Can you please send me the complete log messages. They should look somehow like these (I took them from the example application): 2002-12-05 15:27:52 action: Processing a GET for /beginWf1Transition 2002-12-05 15:27:52 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:27:52 action: Authtype: com.livinglogic.struts.workflow.test.Authentication 2002-12-05 15:27:52 action: Previous primary workflow: null 2002-12-05 15:27:52 action: Current primary workflow: wf1 2002-12-05 15:27:52 action: Updating workflow: wf1 2002-12-05 15:27:52 action: Setting currentState to 1 2002-12-05 15:27:52 action: Setting definedNextStates to [2] 2002-12-05 15:27:52 action: Setting definedNextPaths to [] 2002-12-05 15:27:52 action: Forward to: /inHome.jspp 2002-12-05 15:28:03 action: Processing a GET for /wf1St2Transition 2002-12-05 15:28:03 action: Looking for Action instance for class com.livinglogic.struts.workflow.test.Wf1Action 2002-12-05 15:28:03 action: Authtype
Re: AW: Workflow Extention
Jordan, I think I understand pretty well, what you are trying to do. However according to your configuration you should not be able to execute /registration/2 before having executed /registration/1. Here are some examples: /registration - /registration/1 - /registration/1-/registration/2 - this should work /registration - /registration/1 - /registration/3 - this should fail with the last action /registration - /registration/1 - /registration/2-/registration/1 - this should fail with the last action /registration - /registration/1 - /someAction-/registration/2 - this should work, if /someAction is not part of the workflow Maybe you can try these examples out and see if it works as expected. Remark to the last example: The last example works, if /someAction is not part of the registration-workflow, because it does not change the state of this workflow. --- Matthias Jordan Thomas wrote: Yes, I see what you are saying and if I define the next state, then if I try to jump out of the workflow I get a an exception saying that it is not allowed by the workflow. What makes me think that it is disregarding the wrokflow is that I can enter the workflow at an point (i.e /registration/2) without having executed any of the other steps. Essentially, all I want to do is not control where the user goes but where the user came from. This way, it cascades backwards ensuring that the user enters in all of the data. Is this clearer? Hopefully you have an idea on how to solve this one. Cheers and thanks for the help Jordan -Ursprüngliche Nachricht- Von: Matthias Bauer [mailto:[EMAIL PROTECTED]] Gesendet: Wednesday, 27 November 2002 1:22 PM An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: Workflow Extention Jordan, according to the configuration the user should not be able to execute /registration/1 before having executed /registration. Also /registration/2 can not be executed before /registration/1, and so on. What the configuration does NOT prohibit, is to execute /registration or any other action after /registration/1 or /registration/2, because you are not defining nextState values. Do you see something else? What lets you think that it seems to be disregarding the workflow? One remark: You can as well leave away the property endWorkflow if you want it to be false, because this is the default. --- Matthias Jordan Thomas wrote: Matthias, Ok, I tried that and it now seems to be disregarding the workflow. Can you seen anything wrong with my struts-config.xml tags? (Sorry for the big code chunk :O) Essentially what (am trying to do is allow a user to go to the next step or stay on the same step. I am using struts 1.1b Thanks Jordan --action class ... public final class NewRegistrationAction extends GenericAction { public ActionForward performAction( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { ... --struts-config.xml action path=/registration type=scoop.web.struts.registration.NewRegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping scope=request input=/tiles/registrationDetails validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=0/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registrationDetails/ /action action path=/registration/1 type=scoop.web.struts.registration.NewRegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=session input=/tiles/registerCompany_step1 validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=1/ set-property property=prevState value=0/ set-property property=prevState value=1/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany_step1/ /action action path=/registration/2 type=scoop.web.struts.registration.NewRegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping name=registrationForm scope=session input=/tiles/registerCompany_step2 validate=true set-property property=primaryWorkflow value=registration-workflow/ set-property property=newState value=2/ set-property property=prevState value=1/ set-property property=prevState value=2/ set-property property=endWorkflow value=false/ forward name=success path=/tiles/registerCompany_step2/ /action action path=/registration/3 type=scoop.web.struts.registration.NewRegistrationAction className=com.livinglogic.struts.workflow.ApplicationMapping