Vishwanath Krishnamurthi's blog

A blog on Java EE, clean code, open source and TDD

Posts Tagged ‘SWF

Spring Webflow – Tips

with one comment

Just a random list of tips – handy if you are using SWF

Passing a String in an evaluate expression:

To pass a string literal, enclose the string in single quotes ‘ ‘ as in

<evaluate expression="searchService.fetchSearchResult('hello')  result="flowScope.searchResult" />

Set a boolean 

Likewise to set a boolean value,

<set name="flowScope.isTicketAvailable" value=" 'true' "/>

Flush flow changes without restarting the server

While developing, do set, development=true as such and save yourself lots of time

<flow:flow-builder-services id="flowBuilderServices"
 view-factory-creator="viewFactoryCreator" development="true"/>

The RequestControlContext object

 On the rare cases where you need a requestControlContext in your bean, you can get hold of it by passing ‘flowRequestContext’ from the flow.

<evaluate expression="someBean.someMethod( flowRequestContext)">

public void someMethod(RequestControlContext context){ //your operation

The start state

During development, if you wanted to skip ahead a few states, just define the start-state in the <flow> element.

Want to trace the flow?

Its pretty simple to add a couple of methods in your listener that extends FlowExecutionListenerAdapter

 public void stateEntered(RequestContext context,
 StateDefinition previousState, StateDefinition newState) {
logger.debug("Entered State:" + newState.getId());
 public void transitionExecuting(RequestContext context, TransitionDefinition transition)
 logger.debug("Executing transition:" + transition.getId());

and trace the flow.

Written by Vishwanath Krishnamurthi

May 19, 2012 at 1:37 am

Posted in Spring

Tagged with , ,