Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Spring Web Flow

Reply
 
Thread Tools Display Modes
  #1  
Old Oct 29th, 2006, 05:18 AM
klr8 klr8 is offline
Senior Member
Spring Team
 
Join Date: Sep 2004
Location: Leuven, Belgium
Posts: 1,846
Default Tip: Accessing a flow execution from outside Spring Web Flow

This thread discusses the "Accessing a flow execution from outside Spring Web Flow" tip published on the Ervacon Spring Web Flow Portal.

Read the tip at

http://www.ervacon.com/products/swf/tips/tip1.html
Reply With Quote
  #2  
Old Oct 30th, 2006, 04:13 AM
ojs ojs is offline
Senior Member
 
Join Date: Jul 2005
Location: Munich, Germany
Posts: 153
Thumbs up

The code helped me a lot! Thanks a bunch to the author! The only change I made for my use, was to inject the formController instead of getting the ApplicationContext (which I already had, because I extended AbstractController) and then obtaining the formController via getBean().

I'm just wondering if such a common requirement (accessing flow data outside a flow) should require so much custom code in my application. A static method provided by SWF would be a really nice improvement for 1.0.1 :-)

Something like -

FlowExecution flowExecution = FlowExecutionHolder.getFlowExecution(request, flowExecutionKey);


Best

Oliver
Reply With Quote
  #3  
Old Oct 30th, 2006, 04:21 AM
klr8 klr8 is offline
Senior Member
Spring Team
 
Join Date: Sep 2004
Location: Leuven, Belgium
Posts: 1,846
Default

Quote:
I'm just wondering if such a common requirement (accessing flow data outside a flow) should require so much custom code in my application. A static method provided by SWF would be a really nice improvement for 1.0.1 :-)
I have been thinking the same thing.
I'll discuss this with Keith to see what our policy is going to be.

Erwin
Reply With Quote
  #4  
Old Jan 26th, 2007, 02:50 PM
strokov strokov is offline
Junior Member
 
Join Date: Sep 2006
Posts: 19
Default

I do something like this to instead of reading the flowScope , modify it... but seems like is not really working.. any ideas?


if (handler.isFlowExecutionKeyPresent(externalContext )) {
try {
ExternalContextHolder.setExternalContext(externalC ontext);
FlowExecutionKey flowExecutionKey = flowE.parseFlowExecutionKey(handler.extractFlowExe cutionKey(externalContext));
FlowExecution flowExecution = flowE.getFlowExecution(flowExecutionKey);


MutableAttributeMap flowScope = flowExecution.getActiveSession().getScope();
if(flowScope.get("VALUETOMODIFY").toString() != null){
flowScope.put("VALUETOMODIFY","New Data";
chain.doFilter(request, response);
return;

}
catch (Exception e) {
e.printStackTrace();
}
finally {
ExternalContextHolder.setExternalContext(null);
}
}

regards...
Reply With Quote
  #5  
Old Jan 28th, 2007, 02:14 AM
klr8 klr8 is offline
Senior Member
Spring Team
 
Join Date: Sep 2004
Location: Leuven, Belgium
Posts: 1,846
Default

Modifying a flow execution from outside SWF, and hence outside the flow execution, is not really a supported use-case.
It's not impossible but it will be quite a bit of custom coding: after getting the flow execution you'll have to save it again using the flow execution repo in use.

Erwin
Reply With Quote
  #6  
Old Jun 10th, 2007, 01:04 AM
jessica1983 jessica1983 is offline
Junior Member
 
Join Date: Jun 2007
Posts: 4
Default Similar but with one new product for integration

Hi people,

I wondering if anyone had tried integrating the following architecture for their web applications:
Ext-js - Screen Design and validation
DWR - Data loading mechanism
Spring webflow - form handling and screen flow

Presently, I am trying to integrate these three products together. Really enjoy what Ext-JS has to provide in terms of validation, screen designs and their functionalities.
However, I am having a problem in displaying the form data pass over by Spring webflow using Ext-Js.

There are two way of approach which i will wan to explore:

1. I will like to access the flow execution outside of SWF. However, I will need the request to be pass in using DWR. Hence not very sure of how to go about it therefore i currently trying the 2nd approach which is not working
2. As Spring Webflow is using JSTL to display the form data on the JSPs, however by using Ext-JS we are using javascript to load the form elements and data.

Example:
Spring webflow samples app display the passed over form data like this:
<input type="text" id="myID" value="<c:out value="{$env.ID}"/>"/>
Hence, I tried using the following method in ext-js (which did not work):
var myIDTextField = new Ext.form.TextField({
id:'myID',
inputType:'text',
width:100,
label:'ID',
value:'<c:out value="{$env.ID}"/>'
});

Hence, I am facing such a problem as describe above over there.
Hope tat you guys can lend me a hand here....

thanks so much!!!
Jessica
Reply With Quote
  #7  
Old Jun 10th, 2007, 08:08 AM
dr_pompeii dr_pompeii is offline
Senior Member
 
Join Date: Aug 2006
Location: Arequipa-Peru / South America
Posts: 1,587
Thumbs up SWF roolz

klr8

thanks for this solution, well i am not an expert in SWF, only i have the enough knowledge to work happy with SWF

about this
Quote:
In some situations it is usefull to get access to a Spring Web Flow flow execution from outside of Spring Web Flow itself.
maybe the question is silly , but,
can you share some situations ???

hi jessica1983

Quote:
Ext-js - Screen Design and validation
DWR - Data loading mechanism
Spring webflow - form handling and screen flow
i used to work with the 2 last,but
Quote:
However, I am having a problem in displaying the form data pass over by Spring webflow using Ext-Js.
exactly , what is the problem??
empty field? or some other message error from the server?

thanks for advanced
__________________
- Manuel Jordan

Kill Your Pride, Share Your Knowledge With All
The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7
Use [ c o d e ] [ / c o d e ] tags

Blog
LinkedIn


Technical Reviewer of Apress
  • Pro SpringSource dm Server
  • Spring Enterprise Recipes: A Problem-Solution Approach
  • Spring Recipes: A Problem-Solution Approach, Second Edition
Reply With Quote
  #8  
Old Jun 10th, 2007, 09:07 AM
jessica1983 jessica1983 is offline
Junior Member
 
Join Date: Jun 2007
Posts: 4
Default Hi there!!! here is my description

Hi there!!!

thanks for much for your prompt reply / help.

- I will like to use DWR to display the form data
- However, the form data is stored in the flow execution (SWF).

From how I understand it, DWR is a request-on-demand approach. Therefore, DWR cannot be triggered using SWF flow execution. Hence, after looking through the thread over there - "Accessing a flow execution from outside of Spring Web Flow" i thought that maybe it is possible to trigger DWR from javascript where DWR bean will access the flowexecutionkey / request. The problem is, I am not so sure how to go about it in terms of configuration and getting the flowexecutionkey / request / session. I tried the example given in the thread but it seems like I had to throw in the flowexecutionkey / session / request in order to access the form data in Spring webflow.

Hence I really need some help here...

I really like to thank you for your help.

Many Thanks,
Jessica
Reply With Quote
  #9  
Old Jun 10th, 2007, 09:17 AM
dr_pompeii dr_pompeii is offline
Senior Member
 
Join Date: Aug 2006
Location: Arequipa-Peru / South America
Posts: 1,587
Default

Dear jessica

Quote:
From how I understand it, DWR is a request-on-demand approach.
well i only know that thi is a good tool/framework to work with ajax and java with objects

Quote:
Therefore, DWR cannot be triggered using SWF flow execution.
well not, DWR use js (some event) to call the server, is ajax simply

Quote:
thought that maybe it is possible to trigger DWR from javascript where DWR bean will access the flowexecutionkey / request.
normally if i ise DWR to change my bean, in the next action-state of the flow i must update the object, maybe other approach can be valid too

Quote:
The problem is, I am not so sure how to go about it in terms of configuration and getting the flowexecutionkey / request / session.
can you share exactly tha case/problem that you want resolve?

regards
__________________
- Manuel Jordan

Kill Your Pride, Share Your Knowledge With All
The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7
Use [ c o d e ] [ / c o d e ] tags

Blog
LinkedIn


Technical Reviewer of Apress
  • Pro SpringSource dm Server
  • Spring Enterprise Recipes: A Problem-Solution Approach
  • Spring Recipes: A Problem-Solution Approach, Second Edition
Reply With Quote
  #10  
Old Jan 23rd, 2008, 02:34 AM
fanfy fanfy is offline
Senior Member
 
Join Date: Nov 2005
Location: Iasi, Romania
Posts: 100
Default SWF FormDataAccessor

Hi.
I want to implement the XT Ajax FormDataAccesor in order to submit a form using xt ajax and actualy handle the data in the SWF. I'm using JspComponent to render the response. Anyway, this implementation needs to extract the command object and the validation errors from the flow execution. How can I do this? I can extend the FormAction and expose the form errors and command object which are protected. Or I can copy/paste retrieval logic from the FormObjectAccessor class. Is there someone that did this and can help me with a simpler/cleaner solution? Thank you.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:11 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.