You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sh...@ubs.com on 2003/09/30 14:57:59 UTC

RE: [struts workflow extension]workflow problem incase of validation errors.

Hi Mattias,
We have run into another problem with the workflow extension.

We are not using the auto validation mechanism of struts(We set validate=false in action mapping.)

Following is the scenario where we run into problem.The relevant workflow action mapping parameters are indicated in brackets.

Order Entry workflow:
1.page 1 :OrderEntryScreen:The action OrderEntryOpenAction will get the relevant data required to be shown to create the order and send the user to order entry screen.Configuration for OrderEntryOpenAction is((newState = 1,nextState=2).So when the user gets the OrderEntry screen, the action OrderEntryOpenAction  has been already executed and hence the workflow is in state 1.

2.When the user says ok on OrderEntry screen, OrderReviewAction is called which on success will send user to OrderReviewWcreen.The OrderReviewAction is configured as (prevState=1,newState = 2,nextState=3).

As we are not using struts auto validation mechanism , the data is validated inside the execute method of action and in case of errors, user is sent back to input which is generally the same jsp which got the input.SO in OrderReviewAction, I perform the validations and I get an validation error, so I do  return new ActionForward(mapping.getInput()); inside the action.But here as we are already inside the execute of the OrderReviewAction, the workflow checks have already been done and the workFlow state is already set to 2(Eventhough in this action we received validation exception.)So when I do a forward to input(which directly goes to jsp),I get workFLow exception because the forward to jsp is just a forward to input of action mapping .And this does not have any of the workFlow attributes set.So this can not pass the previous state or next state checks of the workFLowLogic.

So how have you handled this case?Should the validation failure be also pointing to another mapping which will reset the workFLow state to previous state?

Any ideas are most welcome.

Regards,
Shirish

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [struts workflow extension]workflow problem incase of validation errors.

Posted by Matthias Bauer <ma...@livinglogic.de>.
Shirish,

I really like your mails, because you always seem to be answering your 
questions for yourself. :-)

It does not make any difference whether the validation checks are done 
in the form or the action: The workflows' states have already been 
updated before. Thus, you need to point your input mapping to an action 
that can display the jsp page instead of the jsp page itself. With this 
you have two options:

1. Either your OrderReviewAction does not set a nextState itself, but 
does a forward (in case the checks are passed successfully) to an action 
that sets the nextState condition and continues processing

2. or you define an action RedisplayOrderEntryScreen that satisfies the 
nextState that has been set.

I would clearly prefer the first option. This is also the one that is 
chosen in the demo application.

As you seem to have decided to use the Struts Workflow Extension in one 
of your projects, have you already considered to get a training course 
or project related coaching on this extension. We are offering both. 
This is the way how we fund the development of the extension. If you are 
interested, contact me directly at matthias.bauer@livinglogic.de

Best regards,

--- Matthias


shirishchandra.sakhare@ubs.com wrote:

>Hi Mattias,
>We have run into another problem with the workflow extension.
>
>We are not using the auto validation mechanism of struts(We set validate=false in action mapping.)
>
>Following is the scenario where we run into problem.The relevant workflow action mapping parameters are indicated in brackets.
>
>Order Entry workflow:
>1.page 1 :OrderEntryScreen:The action OrderEntryOpenAction will get the relevant data required to be shown to create the order and send the user to order entry screen.Configuration for OrderEntryOpenAction is((newState = 1,nextState=2).So when the user gets the OrderEntry screen, the action OrderEntryOpenAction  has been already executed and hence the workflow is in state 1.
>
>2.When the user says ok on OrderEntry screen, OrderReviewAction is called which on success will send user to OrderReviewWcreen.The OrderReviewAction is configured as (prevState=1,newState = 2,nextState=3).
>
>As we are not using struts auto validation mechanism , the data is validated inside the execute method of action and in case of errors, user is sent back to input which is generally the same jsp which got the input.SO in OrderReviewAction, I perform the validations and I get an validation error, so I do  return new ActionForward(mapping.getInput()); inside the action.But here as we are already inside the execute of the OrderReviewAction, the workflow checks have already been done and the workFlow state is already set to 2(Eventhough in this action we received validation exception.)So when I do a forward to input(which directly goes to jsp),I get workFLow exception because the forward to jsp is just a forward to input of action mapping .And this does not have any of the workFlow attributes set.So this can not pass the previous state or next state checks of the workFLowLogic.
>
>So how have you handled this case?Should the validation failure be also pointing to another mapping which will reset the workFLow state to previous state?
>
>Any ideas are most welcome.
>
>Regards,
>Shirish
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org