• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Modify the flowScope value using HTTP Request Object

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brothers & Sisters,

In my project i am using Spring Webflow (baseflow and subflow architecture). As per spring webflow functionality for each and every action i am using unique transcation id to perform the actions and put the required values in flowScope attribute, as per instruction i am not put any values in HTTP session attribute. so for every action the page get refresh.

As per usability comments i have been requested to change few actions with AJAX call so that the page will not refresh, so i have been start working on it but i am stuck in one point.

I am able to read the flowScope attribute value using httpservletrequest object ( because during ajax call httpservlet request/response are the only input parameters ) but i am not able the modify the flowScope attribute value but it is necessary for me to complete the functionality.

Please guide me to resolve to the solution this scenario.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will admit that in the projects I have worked on I have not yet had the opportunity to use Web Flow nor have I had time to play with it at home. So maybe someone else will come along and comment on this, but have you read this portion of the documentation? Are you using tiles?

http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch12s05.html
 
Pandian Raman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill,

I have gone through the link which you have suggested but sorry yar i didnt get the solution.

Now my problem is my entire project values are maintain in flowScope attributes but i am trying to modify the flowScope attribute using AJAX input parameter HTTPServletRequest/Response object. But i can't. So i need a solution like how to modify the flowScope attribute value using HTTPServletRequest/Response object.

Regards,
Pandian R
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok well I think the link I gave you before is the suggested way to use Ajax.

From the java doc

Action Interface:

Execute this action. Action execution will occur in the context of a request associated with an active flow execution.

Action invocation is typically triggered in a production environment by a state within a flow carrying out the execution of a flow definition. The result of action execution, a logical outcome event, can be used as grounds for a transition out of the calling state.

Note: The RequestContext argument to this method provides access to data about the active flow execution in the context of the currently executing thread. Among other things, this allows this action to access data set by other actions, as well as set its own attributes it wishes to expose in a given scope.

Some notes about actions and their usage of the attribute scope types:

Attributes set in request scope exist for the life of the currently executing request only.
Attributes set in flash scope exist until the next external user event is signaled. That time includes the current request plus any redirect or additional refreshes to the next view.
Attributes set in flow scope exist for the life of the flow session and will be cleaned up automatically when the flow session ends.
Attributes set in conversation scope exist for the life of the entire flow execution representing a single logical "conversation" with a user.

All attributes present in any scope are typically exposed in a model for access by a view when an "interactive" state type such as a view state is entered.

Note: flow scope should generally not be used as a general purpose cache, but rather as a context for data needed locally by other states of the flow this action participates in. For example, it would be inappropriate to stuff large collections of objects (like those returned to support a search results view) into flow scope. Instead, put such result collections in request scope, and ensure you execute this action again each time you wish to view those results. 2nd level caches managed outside of SWF are more general cache solutions.

Note: as flow scoped attributes are eligible for serialization they should be Serializable.



And the FlowSession Interface


A single, local instantiation of a flow definition launched within an overall flow execution.

This object maintains all instance state including session status within exactly one governing FlowExecution, as well as the current flow state. This object also acts as the local "flow scope" data model. Data in flow scope lives for the life of this object and is cleaned up automatically when this object is destroyed. Destruction happens when this session enters an end state.

Note that a flow session is in no way linked to an HTTP session. It just uses the familiar "session" naming convention to denote a stateful object.



Note especially the last line where it says it is in no way linked to an HTTP session.

On a side note this guy seems to have done something similar to what it is you are trying to do. I am still not convinced its the best way but I don't know enough about WebFlow to argue that point.
http://ytoh.wordpress.com/2011/09/07/flow-accessing-webflow-data-in-spring-mvc-controllers/

Also there is Spring Sample project on github that uses Ajax for some stuff, you might want to check it out as well.
https://github.com/SpringSource/spring-webflow-samples
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic